summaryrefslogtreecommitdiffstats
path: root/test/units/plugins
diff options
context:
space:
mode:
authorSloane Hertel <19572925+s-hertel@users.noreply.github.com>2023-02-28 21:21:48 +0100
committerGitHub <noreply@github.com>2023-02-28 21:21:48 +0100
commitb981a9dfcd1f799abf6183eade556e653792cc03 (patch)
treebb339d6f495209576784e1d2bfb5330ec6b5d6ef /test/units/plugins
parentRelocate and refactor ansible-test diff unit tests (#80113) (diff)
downloadansible-b981a9dfcd1f799abf6183eade556e653792cc03.tar.xz
ansible-b981a9dfcd1f799abf6183eade556e653792cc03.zip
add a worker queue to get updates from the main results thread (#79886)
* Create a queue per WorkerProcess to receive intra-task updates * Update `pause` action to use the worker queue * Deprecate ConnectionBase()._new_stdin * Add new `Display` convenience method `prompt_until` to manage both controller- and worker-sourced prompting without cross-fork stdin sharing, in-worker mechanism to handle request-response over new worker queue.
Diffstat (limited to 'test/units/plugins')
-rw-r--r--test/units/plugins/action/test_pause.py89
1 files changed, 0 insertions, 89 deletions
diff --git a/test/units/plugins/action/test_pause.py b/test/units/plugins/action/test_pause.py
deleted file mode 100644
index cbd9a17d21..0000000000
--- a/test/units/plugins/action/test_pause.py
+++ /dev/null
@@ -1,89 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2021 Ansible Project
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import absolute_import, division, print_function
-__metaclass__ = type
-
-import curses
-import importlib
-import io
-import pytest
-import sys
-
-from ansible.plugins.action import pause # pylint: disable=unused-import
-from ansible.module_utils.six import PY2
-
-builtin_import = 'builtins.__import__'
-if PY2:
- builtin_import = '__builtin__.__import__'
-
-
-def test_pause_curses_tigetstr_none(mocker, monkeypatch):
- monkeypatch.delitem(sys.modules, 'ansible.plugins.action.pause')
-
- dunder_import = __import__
-
- def _import(*args, **kwargs):
- if args[0] == 'curses':
- mock_curses = mocker.Mock()
- mock_curses.setupterm = mocker.Mock(return_value=True)
- mock_curses.tigetstr = mocker.Mock(return_value=None)
- return mock_curses
- else:
- return dunder_import(*args, **kwargs)
-
- mocker.patch(builtin_import, _import)
-
- mod = importlib.import_module('ansible.plugins.action.pause')
-
- assert mod.HAS_CURSES is True
- assert mod.MOVE_TO_BOL == b'\r'
- assert mod.CLEAR_TO_EOL == b'\x1b[K'
-
-
-def test_pause_missing_curses(mocker, monkeypatch):
- monkeypatch.delitem(sys.modules, 'ansible.plugins.action.pause')
-
- dunder_import = __import__
-
- def _import(*args, **kwargs):
- if args[0] == 'curses':
- raise ImportError
- else:
- return dunder_import(*args, **kwargs)
-
- mocker.patch(builtin_import, _import)
-
- mod = importlib.import_module('ansible.plugins.action.pause')
-
- with pytest.raises(AttributeError):
- mod.curses # pylint: disable=pointless-statement
-
- assert mod.HAS_CURSES is False
- assert mod.MOVE_TO_BOL == b'\r'
- assert mod.CLEAR_TO_EOL == b'\x1b[K'
-
-
-@pytest.mark.parametrize('exc', (curses.error, TypeError, io.UnsupportedOperation))
-def test_pause_curses_setupterm_error(mocker, monkeypatch, exc):
- monkeypatch.delitem(sys.modules, 'ansible.plugins.action.pause')
-
- dunder_import = __import__
-
- def _import(*args, **kwargs):
- if args[0] == 'curses':
- mock_curses = mocker.Mock()
- mock_curses.setupterm = mocker.Mock(side_effect=exc)
- mock_curses.error = curses.error
- return mock_curses
- else:
- return dunder_import(*args, **kwargs)
-
- mocker.patch(builtin_import, _import)
-
- mod = importlib.import_module('ansible.plugins.action.pause')
-
- assert mod.HAS_CURSES is False
- assert mod.MOVE_TO_BOL == b'\r'
- assert mod.CLEAR_TO_EOL == b'\x1b[K'