Skip to content

Commit

Permalink
ansible-test - Add minimum constraints for pytest.
Browse files Browse the repository at this point in the history
Use `--strict` for `pytest` on Python 2.6 since `--strict-markers` is not available.
  • Loading branch information
mattclay committed Sep 24, 2021
1 parent a2d4a8a commit b51e62f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions changelogs/fragments/ansible-test-pytest-constraints.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
minor_changes:
- ansible-test - Set minimum version constraints for ``pytest``.
bugfixes:
- ansible-test - Use ``--strict`` for ``pytest`` on Python 2.6 since ``--strict-markers`` is not available.
5 changes: 3 additions & 2 deletions test/lib/ansible_test/_data/requirements/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ pywinrm >= 0.3.0 # message encryption support
wheel < 0.30.0 ; python_version < '2.7' # wheel 0.30.0 and later require python 2.7 or later
idna < 2.6, >= 2.5 # linode requires idna < 2.9, >= 2.5, requests requires idna < 2.6, but cryptography will cause the latest version to be installed instead
paramiko < 2.4.0 ; python_version < '2.7' # paramiko 2.4.0 drops support for python 2.6
pytest < 3.3.0 ; python_version < '2.7' # pytest 3.3.0 drops support for python 2.6
pytest < 5.0.0 ; python_version == '2.7' # pytest 5.0.0 and later will no longer support python 2.7
pytest < 3.3.0, >= 3.1.0 ; python_version < '2.7' # pytest 3.3.0 drops support for python 2.6
pytest < 5.0.0, >= 4.5.0 ; python_version == '2.7' # pytest 5.0.0 and later will no longer support python 2.7
pytest >= 4.5.0 ; python_version > '2.7' # pytest 4.5.0 added support for --strict-markers
pytest-forked < 1.0.2 ; python_version < '2.7' # pytest-forked 1.0.2 and later require python 2.7 or later
pytest-forked >= 1.0.2 ; python_version >= '2.7' # pytest-forked before 1.0.2 does not work with pytest 4.2.0+ (which requires python 2.7+)
ntlm-auth >= 1.3.0 # message encryption support using cryptography
Expand Down
5 changes: 4 additions & 1 deletion test/lib/ansible_test/_internal/commands/units/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,10 @@ def command_units(args):
if not data_context().content.collection:
cmd.append('--durations=25')

if python.version != '2.6':
if python.version == '2.6':
# same as --strict-markers in older versions of pytest which still support python 2.6
cmd.append('--strict')
else:
# added in pytest 4.5.0, which requires python 2.7+
cmd.append('--strict-markers')

Expand Down

0 comments on commit b51e62f

Please sign in to comment.