Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define python_requires for ansible-test #349

Merged
merged 2 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/347-ansible-test-python-requires.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
trivial:
- ci - define `python_requires` for `ansible-test` (https://github.com/ansible-collections/community.digitalocean/issues/347).
mamercad marked this conversation as resolved.
Show resolved Hide resolved
41 changes: 41 additions & 0 deletions tests/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Sample ansible-test configuration file for collections.
# Support for this feature was first added in ansible-core 2.12.
# Use of this file is optional.
# If used, this file must be placed in "tests/config.yml" relative to the base of the collection.

modules:
# Configuration for modules/module_utils.
# These settings do not apply to other content in the collection.

python_requires: ~= 3.9
# Python versions supported by modules/module_utils.
# This setting is required.
#
# Possible values:
#
# - 'default' - All Python versions supported by Ansible.
# This is the default value if no configuration is provided.
# - 'controller' - All Python versions supported by the Ansible controller.
# This indicates the modules/module_utils can only run on the controller.
# Intended for use only with modules/module_utils that depend on ansible-connection, which only runs on the controller.
# Unit tests for modules/module_utils will be permitted to import any Ansible code, instead of only module_utils.
# - SpecifierSet - A PEP 440 specifier set indicating the supported Python versions.
# This is only needed when modules/module_utils do not support all Python versions supported by Ansible.
# It is not necessary to exclude versions which Ansible does not support, as this will be done automatically.
#
# What does this affect?
#
# - Unit tests will be skipped on any unsupported Python version.
# - Sanity tests that are Python version specific will be skipped on any unsupported Python version that is not supported by the controller.
#
# Sanity tests that are Python version specific will always be executed for Python versions supported by the controller, regardless of this setting.
# Reasons for this restriction include, but are not limited to:
#
# - AnsiballZ must be able to AST parse modules/module_utils on the controller, even though they may execute on a managed node.
# - ansible-doc must be able to AST parse modules/module_utils on the controller to display documentation.
# - ansible-test must be able to AST parse modules/module_utils to perform static analysis on them.
# - ansible-test must be able to execute portions of modules/module_utils to validate their argument specs.
#
# These settings only apply to modules/module_utils.
# It is not possible to declare supported Python versions for controller-only code.
# All Python versions supported by the controller must be supported by controller-only code.
Loading