Commit Graph

96 Commits (master)

Author SHA1 Message Date
Alex Willmer 92c00d913e tests: Skip "discovered python matches invoked" on macOS 11/Python 2.7/Vanilla 3 months ago
Alex Willmer 5ad3d14ceb mitogen: Support PEP 451 ModuleSpec API, required for Python 3.12
importlib.machinery.ModuleSpec and find_spec() were introduced in Python 3.4
under PEP 451. They replace the find_module() API of PEP 302, which was
deprecated from Python 3.4. They were removed in Python 3.12 along with the
imp module.

This change adds support for the PEP 451 APIs. Mitogen should no longer import
imp on Python versions that support ModuleSpec. Tests have been added to cover
the new APIs.

CI jobs have been added to cover Python 3.x on macOS.

Refs #1033
Co-authored-by: Witold Baryluk <witold.baryluk@gmail.com>
3 months ago
Alex Willmer e2f4d9275c tests: Fix ansible_python_interpreter & discovered_interpreter_python tests on macOS
Should account for fiddling in mitogen.parent.Connection._first_stage() and
symlinks. I won't be surprised if it breaks again soon and often.
3 months ago
Alex Willmer a6a5c5bb97 tests: Clarify status/purpose of Python 2.x era Ansible Module workaround 3 months ago
Alex Willmer 2839954559 tests: Account for /tmp symlink in virtualenv test on macOS 3 months ago
Alex Willmer 591152bef0 tests: Avoid intermittant 2 hour timeout in new style Ansible module tests
This has been lurking for years, raising it's head at unpredictable times.
This change doesn't fix it, but it should make it a lot less mysterious.
3 months ago
Alex Willmer bde7f062b9 tests: Fix Ansible module shebangs
With https://github.com/ansible/ansible/pull/76677 Ansible
fixed shebang substitution for Ansible modules and tightened
up what shebang is allowed.

Changing these fixes the tests using them with vanilla Ansible.

https://docs.ansible.com/ansible/latest/dev_guide/testing/sanity/shebang.html
3 months ago
Nerijus Baliūnas 4089e875a9 Add Python 3.11 support
Co-authored-by: Alex Willmer <alex@moreati.org.uk>
10 months ago
Alex Willmer 1871f2a9b1 Remove vendored mitogen.compat.simplejson
Python 2.6 added json to the stdlib. We no longer support Python <= 2.7 in
Mitogen 0.3.x, so this fallback is unneeded complexity. Fixes #659
1 year ago
Alex Willmer 99fe9d48e6 tests: Print task durations 2 years ago
Alex Willmer 39dfd2dfe8 ci: Upgrade VM Images to macOS 11 and Ubuntu 20.04 2 years ago
Alex Willmer 18c89de5a9 Remove unused module imports 2 years ago
Alex Willmer a8317c2393 tests: Remove unittest2, use stdlib unittest
unittest2 is incomplatible with Python 3.10
2 years ago
Alex Willmer 5805e30232 tests: Remove unused imports 2 years ago
Alex Willmer d9b8d50d4e Fix ansible.__version__ comparisons with multi-digit components
Ansible 2.8 is older than Ansible 2.10, but `'2.8' < '2.10' == False`
3 years ago
Alex Willmer e194a6367f ci: Fix version comparisons involving double digits
See https://gist.github.com/moreati/e7507c5b606b12ec0ddafcb7c8debbf1
3 years ago
Steven Robertson 22cce2dfae Merge branch 'master' into collectionsSupport 4 years ago
Alex Willmer 79b4c0f815 tests: Fix AttributeError in callback plugins used by test suite
CALLBACK_VERSION et al are documented as required in
https://docs.ansible.com/ansible/2.10/dev_guide/developing_plugins.html#callback-plugins.
The need for document_fragment is noted in
cfa8075537/lib/ansible/plugins/callback/default.py (L28-L32)

Fixes #758

This addresses the following error, seen while running
`ansible_tests.py`.

```
TASK [Gathering Facts gather_timeout=10, gather_subset=['all']]
****************
task path:
/home/alex/src/mitogen/tests/ansible/regression/issue_109__target_has_old_ansible_installed.yml:4
[WARNING]: Failure using method (v2_runner_on_start) in callback plugin
(<ansible.plugins.callback.nice_stdout.CallbackModule object at
0x7f76b3dad090>): 'show_per_host_start'
Callback Exception:
File
"/home/alex/src/mitogen/.tox/py27-ansible2.10/lib/python2.7/site-packages/ansible/executor/task_queue_manager.py",
line 372, in send_callback
    method(*new_args, **kwargs)
File
"/home/alex/src/mitogen/.tox/py27-ansible2.10/lib/python2.7/site-packages/ansible/plugins/callback/default.py",
line 240, in v2_runner_on_start
    if self.get_option('show_per_host_start'):
File
"/home/alex/src/mitogen/.tox/py27-ansible2.10/lib/python2.7/site-packages/ansible/plugins/callback/__init__.py",
line 91, in get_option
    return self._plugin_options[k]
Callback Exception:
File
"/home/alex/src/mitogen/.tox/py27-ansible2.10/lib/python2.7/site-packages/ansible/executor/task_queue_manager.py",
line 372, in send_callback
    method(*new_args, **kwargs)
File
"/home/alex/src/mitogen/.tox/py27-ansible2.10/lib/python2.7/site-packages/ansible/plugins/callback/default.py",
line 240, in v2_runner_on_start
    if self.get_option('show_per_host_start'):
File
"/home/alex/src/mitogen/.tox/py27-ansible2.10/lib/python2.7/site-packages/ansible/plugins/callback/__init__.py",
line 91, in get_option
    return self._plugin_options[k]
[task 339882] 00:00:08.172036 D ansible_mitogen.affinity: CPU mask for
WorkerProcess: 0x000004
Callback Exception:
File
"/home/alex/src/mitogen/.tox/py27-ansible2.10/lib/python2.7/site-packages/ansible/executor/task_queue_manager.py",
line 372, in send_callback
    method(*new_args, **kwargs)
File
"/home/alex/src/mitogen/.tox/py27-ansible2.10/lib/python2.7/site-packages/ansible/plugins/callback/default.py",
line 240, in v2_runner_on_start
    if self.get_option('show_per_host_start'):
File
"/home/alex/src/mitogen/.tox/py27-ansible2.10/lib/python2.7/site-packages/ansible/plugins/callback/__init__.py",
line 91, in get_option
    return self._plugin_options[k]
```
4 years ago
Steven Robertson 9e17c98f3f adding hopefully new-style import that works for Ansible 2.10 4 years ago
Steven Robertson 941132c040 revert missing interpreter change, it breaks with Mitogen and without Mitogen, something else might be causing new-style detection to not work 4 years ago
Steven Robertson 2ecf227e1f oops, broke new-style missing interpreter detection. Regex should match now 4 years ago
Steven Robertson cf3d646613 fix custom_python_new_style_missing_interpreter, looks like Ansible 2.10 changed how new-style module detection works 4 years ago
Steven Robertson 518324c371 fix regression in Darwin 19 (OSX 10.15+) ansible python interpreter detection 4 years ago
Steven Robertson faf7798c16 revert python3 setup + add TODO; python3 tests aren't working now but python2 is EOL so they should work soon 4 years ago
Steven Robertson 0a34d378c9 change virtualenv creation when running with python 3 4 years ago
Steven Robertson 6d179da480 ported over tests from ansible validating python interpreter discovery 4 years ago
David Wilson d6329f3446 Merge devel/290 @ 79b979ec8544ef5d8620c64068d4a42fabf50415 5 years ago
David Wilson 5ed0b93669 tests: update gcloud.py to match terraform config 5 years ago
David Wilson a39169ff16 [linear2] fix mitogen_shutdown_all service context access 5 years ago
David Wilson ee7dae7514 ci: Another round of fixes for random Ansible UI breakage in 2.7/2.8 5 years ago
David Wilson 418fc15e80 tests: allow running without hdrhistograms library. 5 years ago
David Wilson 0b7fd3f290 issue #591: ansible: restore CWD prior to AnsibleModule initialization. 5 years ago
David Wilson a1f2ec222d issue #590: fix test for <2.8 Ansibles. 5 years ago
David Wilson 7a5c436a39 issue #590: Ansible test for module_utils.distro use. 5 years ago
David Wilson 2bd0bbd4df issue #555: ansible: workaround ancient reload(sys) hack.
This is the most minimal change for what might be relatively minimal
edge case. Alternative is replacing reload(), but let's not do that yet.

Closes #555
5 years ago
David Wilson 30b8172573 issue #554: mitogen_action_script fix 5 years ago
David Wilson f36b4b47bf issue #554: don't rely on tmp_path autoremoval in test.
Ansible doesn't do this, so we shouldn't either.
5 years ago
David Wilson b59a47aecb tests: make mitogen_shutdown_all be run_once by default. 5 years ago
David Wilson abb0319bbb issue #477: get rid of perl JSON module requirement. 5 years ago
David Wilson 2f087859bc issue #477: 2.4-compatible syntax. 5 years ago
David Wilson 532ae92029 issue #477: Ansible 2.3 requires placeholder module for assert_equals 5 years ago
David Wilson 0b0ae5c971 issue #477: backport various test modules to Python 2.4. 5 years ago
David Wilson 462a8567e5 issue #477: add all() polyfill to custom_python_detect_environmnet 5 years ago
David Wilson be8562ce09 issue #477: Ansible 2.3 had stricter arg spec format. 5 years ago
David Wilson 66b64cae2c issue #477: older Ansibles had no vars plugin base class. 5 years ago
David Wilson 23866084d7 issue #412: promote "mitogen_get_stack" to the main extension.
This is to make it easier for users to diagnose their own problems.
5 years ago
David Wilson d72567b15b tests: make assert_equal work on newer Ansibles. 5 years ago
David Wilson 4256d2aa4b tests: make fork_histogram optional 5 years ago
David Wilson 91c9aff9ff tests: import assert_equal action. 5 years ago
David Wilson 8380baf41b issue #461: Ansible 2.3 placeholder modules for action plug-ins. 5 years ago