mirror of https://github.com/ansible/ansible.git
ansible-test - Update import test and sanity requirements. (#76308)
* Add script to freeze sanity requirements. * Declare sanity test requirements and freeze * Use pinned requirements for import.plugin test. * Expand scope of import test for ansible-core. * Add ignores for galaxy import errors. * Update test-constraints sanity test.pull/76310/head
parent
21ac52435b
commit
bb63c97c16
@ -0,0 +1,4 @@
|
|||||||
|
minor_changes:
|
||||||
|
- ansible-test - Declare public dependencies of ansible-core and use to limit unguarded imports in plugins.
|
||||||
|
- ansible-test - Requirements for the plugin import test are now frozen.
|
||||||
|
- ansible-test - Update sanity test requirements.
|
@ -0,0 +1,112 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# PYTHON_ARGCOMPLETE_OK
|
||||||
|
"""Generate frozen sanity test requirements from source requirements files."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import dataclasses
|
||||||
|
import pathlib
|
||||||
|
import subprocess
|
||||||
|
import tempfile
|
||||||
|
import typing as t
|
||||||
|
import venv
|
||||||
|
|
||||||
|
try:
|
||||||
|
import argcomplete
|
||||||
|
except ImportError:
|
||||||
|
argcomplete = None
|
||||||
|
|
||||||
|
|
||||||
|
FILE = pathlib.Path(__file__).resolve()
|
||||||
|
ROOT = FILE.parent.parent
|
||||||
|
SELF = FILE.relative_to(ROOT)
|
||||||
|
|
||||||
|
|
||||||
|
@dataclasses.dataclass(frozen=True)
|
||||||
|
class SanityTest:
|
||||||
|
name: str
|
||||||
|
requirements_path: pathlib.Path
|
||||||
|
source_path: pathlib.Path
|
||||||
|
|
||||||
|
def freeze_requirements(self) -> None:
|
||||||
|
with tempfile.TemporaryDirectory() as venv_dir:
|
||||||
|
venv.create(venv_dir, with_pip=True)
|
||||||
|
|
||||||
|
python = pathlib.Path(venv_dir, 'bin', 'python')
|
||||||
|
pip = [python, '-m', 'pip', '--disable-pip-version-check']
|
||||||
|
env = dict()
|
||||||
|
|
||||||
|
pip_freeze = subprocess.run(pip + ['freeze'], env=env, check=True, capture_output=True, text=True)
|
||||||
|
|
||||||
|
if pip_freeze.stdout:
|
||||||
|
raise Exception(f'Initial virtual environment is not empty:\n{pip_freeze.stdout}')
|
||||||
|
|
||||||
|
subprocess.run(pip + ['install', 'wheel'], env=env, check=True) # make bdist_wheel available during pip install
|
||||||
|
subprocess.run(pip + ['install', '-r', self.source_path], env=env, check=True)
|
||||||
|
|
||||||
|
pip_freeze = subprocess.run(pip + ['freeze'], env=env, check=True, capture_output=True, text=True)
|
||||||
|
|
||||||
|
requirements = f'# edit "{self.source_path.name}" and generate with: {SELF} --test {self.name}\n{pip_freeze.stdout}'
|
||||||
|
|
||||||
|
with open(self.requirements_path, 'w') as requirement_file:
|
||||||
|
requirement_file.write(requirements)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def create(path: pathlib.Path) -> SanityTest:
|
||||||
|
return SanityTest(
|
||||||
|
name=path.stem.replace('sanity.', '').replace('.requirements', ''),
|
||||||
|
requirements_path=path,
|
||||||
|
source_path=path.with_suffix('.in'),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> None:
|
||||||
|
tests = find_tests()
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument(
|
||||||
|
'--test',
|
||||||
|
metavar='TEST',
|
||||||
|
dest='test_names',
|
||||||
|
action='append',
|
||||||
|
choices=[test.name for test in tests],
|
||||||
|
help='test requirements to update'
|
||||||
|
)
|
||||||
|
|
||||||
|
if argcomplete:
|
||||||
|
argcomplete.autocomplete(parser)
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
test_names: set[str] = set(args.test_names or [])
|
||||||
|
|
||||||
|
tests = [test for test in tests if test.name in test_names] if test_names else tests
|
||||||
|
|
||||||
|
for test in tests:
|
||||||
|
print(f'===[ {test.name} ]===')
|
||||||
|
test.freeze_requirements()
|
||||||
|
|
||||||
|
|
||||||
|
def find_tests() -> t.List[SanityTest]:
|
||||||
|
globs = (
|
||||||
|
'test/lib/ansible_test/_data/requirements/sanity.*.txt',
|
||||||
|
'test/sanity/code-smell/*.requirements.txt',
|
||||||
|
)
|
||||||
|
|
||||||
|
tests: t.List[SanityTest] = []
|
||||||
|
|
||||||
|
for glob in globs:
|
||||||
|
tests.extend(get_tests(pathlib.Path(glob)))
|
||||||
|
|
||||||
|
return sorted(tests, key=lambda test: test.name)
|
||||||
|
|
||||||
|
|
||||||
|
def get_tests(glob: pathlib.Path) -> t.List[SanityTest]:
|
||||||
|
path = pathlib.Path(ROOT, glob.parent)
|
||||||
|
pattern = glob.name
|
||||||
|
|
||||||
|
return [SanityTest.create(item) for item in path.glob(pattern)]
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
@ -0,0 +1,3 @@
|
|||||||
|
jinja2 # ansible-core requirement
|
||||||
|
packaging # ansible-core requirement
|
||||||
|
pyyaml # ansible-core requirement
|
@ -1,7 +1,6 @@
|
|||||||
jinja2 == 3.0.1 # ansible-core requirement
|
# edit "sanity.ansible-doc.in" and generate with: hacking/update-sanity-requirements.py --test ansible-doc
|
||||||
pyyaml == 5.4.1 # ansible-core requirement
|
Jinja2==3.0.3
|
||||||
packaging == 21.0 # ansible-doc requirement
|
MarkupSafe==2.0.1
|
||||||
|
packaging==21.2
|
||||||
# dependencies
|
pyparsing==2.4.7
|
||||||
MarkupSafe == 2.0.1
|
PyYAML==6.0
|
||||||
pyparsing == 2.4.7
|
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
antsibull-changelog
|
||||||
|
docutils < 0.18 # match version required by sphinx in the docs-build sanity test
|
@ -1,9 +1,8 @@
|
|||||||
antsibull-changelog == 0.9.0
|
# edit "sanity.changelog.in" and generate with: hacking/update-sanity-requirements.py --test changelog
|
||||||
|
antsibull-changelog==0.12.0
|
||||||
# dependencies
|
docutils==0.17.1
|
||||||
pyyaml == 5.4.1
|
packaging==21.2
|
||||||
docutils == 0.17.1
|
pyparsing==2.4.7
|
||||||
packaging == 21.0
|
PyYAML==6.0
|
||||||
pyparsing == 2.4.7
|
rstcheck==3.3.1
|
||||||
rstcheck == 3.3.1
|
semantic-version==2.8.5
|
||||||
semantic-version == 2.8.5
|
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
pyyaml # needed for yaml_to_json.py
|
@ -0,0 +1,2 @@
|
|||||||
|
jinja2 # ansible-core requirement
|
||||||
|
pyyaml # ansible-core requirement
|
@ -0,0 +1,4 @@
|
|||||||
|
# edit "sanity.import.plugin.in" and generate with: hacking/update-sanity-requirements.py --test import.plugin
|
||||||
|
Jinja2==3.0.3
|
||||||
|
MarkupSafe==2.0.1
|
||||||
|
PyYAML==6.0
|
@ -1 +1,2 @@
|
|||||||
pyyaml == 5.4.1 # needed for yaml_to_json.py
|
# edit "sanity.import.in" and generate with: hacking/update-sanity-requirements.py --test import
|
||||||
|
PyYAML==6.0
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
pyyaml
|
@ -1 +1,2 @@
|
|||||||
pyyaml == 5.4.1
|
# edit "sanity.integration-aliases.in" and generate with: hacking/update-sanity-requirements.py --test integration-aliases
|
||||||
|
PyYAML==6.0
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
pycodestyle
|
@ -1 +1,2 @@
|
|||||||
pycodestyle == 2.6.0
|
# edit "sanity.pep8.in" and generate with: hacking/update-sanity-requirements.py --test pep8
|
||||||
|
pycodestyle==2.8.0
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
pylint == 2.9.3 # currently vetted version
|
||||||
|
pyyaml # needed for collection_detail.py
|
@ -1,10 +1,9 @@
|
|||||||
pylint == 2.9.3
|
# edit "sanity.pylint.in" and generate with: hacking/update-sanity-requirements.py --test pylint
|
||||||
pyyaml == 5.4.1 # needed for collection_detail.py
|
astroid==2.6.6
|
||||||
|
isort==5.10.1
|
||||||
# dependencies
|
lazy-object-proxy==1.6.0
|
||||||
astroid == 2.6.6
|
mccabe==0.6.1
|
||||||
isort == 5.9.3
|
pylint==2.9.3
|
||||||
lazy-object-proxy == 1.6.0
|
PyYAML==6.0
|
||||||
mccabe == 0.6.1
|
toml==0.10.2
|
||||||
toml == 0.10.2
|
wrapt==1.12.1
|
||||||
wrapt == 1.12.1
|
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
pyyaml
|
||||||
|
voluptuous
|
@ -1,2 +1,3 @@
|
|||||||
pyyaml == 5.4.1
|
# edit "sanity.runtime-metadata.in" and generate with: hacking/update-sanity-requirements.py --test runtime-metadata
|
||||||
voluptuous == 0.12.1
|
PyYAML==6.0
|
||||||
|
voluptuous==0.12.2
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
jinja2 # ansible-core requirement
|
||||||
|
pyyaml # needed for collection_detail.py
|
||||||
|
voluptuous
|
@ -1,6 +1,5 @@
|
|||||||
jinja2 == 3.0.1 # ansible-core requirement
|
# edit "sanity.validate-modules.in" and generate with: hacking/update-sanity-requirements.py --test validate-modules
|
||||||
pyyaml == 5.4.1 # needed for collection_detail.py
|
Jinja2==3.0.3
|
||||||
voluptuous == 0.12.1
|
MarkupSafe==2.0.1
|
||||||
|
PyYAML==6.0
|
||||||
# dependencies
|
voluptuous==0.12.2
|
||||||
MarkupSafe == 2.0.1
|
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
yamllint
|
@ -1,5 +1,4 @@
|
|||||||
yamllint == 1.26.0
|
# edit "sanity.yamllint.in" and generate with: hacking/update-sanity-requirements.py --test yamllint
|
||||||
|
pathspec==0.9.0
|
||||||
# dependencies
|
PyYAML==6.0
|
||||||
pathspec == 0.9.0
|
yamllint==1.26.3
|
||||||
pyyaml == 5.4.1
|
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
pyyaml
|
||||||
|
voluptuous
|
@ -1,2 +1,3 @@
|
|||||||
pyyaml == 5.4.1
|
# edit "botmeta.requirements.in" and generate with: hacking/update-sanity-requirements.py --test botmeta
|
||||||
voluptuous == 0.12.1
|
PyYAML==6.0
|
||||||
|
voluptuous==0.12.2
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
jinja2 # ansible-core requirement
|
||||||
|
pyyaml
|
@ -1,5 +1,4 @@
|
|||||||
jinja2 == 3.0.1 # ansible-core requirement
|
# edit "deprecated-config.requirements.in" and generate with: hacking/update-sanity-requirements.py --test deprecated-config
|
||||||
pyyaml == 5.4.1
|
Jinja2==3.0.3
|
||||||
|
MarkupSafe==2.0.1
|
||||||
# dependencies
|
PyYAML==6.0
|
||||||
MarkupSafe == 2.0.1
|
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
jinja2
|
||||||
|
pyyaml
|
||||||
|
resolvelib < 0.6.0
|
||||||
|
sphinx == 4.2.0
|
||||||
|
sphinx-notfound-page
|
||||||
|
sphinx-ansible-theme
|
||||||
|
straight.plugin
|
||||||
|
antsibull
|
@ -1,50 +1,50 @@
|
|||||||
jinja2 == 3.0.1
|
# edit "docs-build.requirements.in" and generate with: hacking/update-sanity-requirements.py --test docs-build
|
||||||
pyyaml == 5.4.1
|
aiofiles==0.7.0
|
||||||
resolvelib == 0.5.4
|
aiohttp==3.8.0
|
||||||
sphinx == 2.1.2
|
aiosignal==1.2.0
|
||||||
sphinx-notfound-page == 0.7.1
|
alabaster==0.7.12
|
||||||
sphinx-ansible-theme == 0.8.0
|
ansible-pygments==0.1.0
|
||||||
straight.plugin == 1.5.0
|
antsibull==0.39.2
|
||||||
antsibull == 0.26.0
|
antsibull-changelog==0.12.0
|
||||||
|
async-timeout==4.0.1
|
||||||
# dependencies
|
asyncio-pool==0.5.2
|
||||||
MarkupSafe == 2.0.1
|
attrs==21.2.0
|
||||||
aiofiles == 0.7.0
|
Babel==2.9.1
|
||||||
aiohttp == 3.7.4.post0
|
certifi==2021.10.8
|
||||||
alabaster == 0.7.12
|
charset-normalizer==2.0.7
|
||||||
ansible-pygments == 0.1.0
|
docutils==0.17.1
|
||||||
antsibull-changelog == 0.9.0
|
frozenlist==1.2.0
|
||||||
async-timeout == 3.0.1
|
idna==3.3
|
||||||
asyncio-pool == 0.5.2
|
imagesize==1.3.0
|
||||||
attrs == 21.2.0
|
Jinja2==3.0.3
|
||||||
babel == 2.9.1
|
MarkupSafe==2.0.1
|
||||||
certifi == 2021.5.30
|
multidict==5.2.0
|
||||||
chardet == 4.0.0
|
packaging==21.2
|
||||||
charset-normalizer == 2.0.5
|
perky==0.5.5
|
||||||
docutils == 0.17.1
|
pydantic==1.8.2
|
||||||
idna == 2.5
|
Pygments==2.10.0
|
||||||
imagesize == 1.2.0
|
pyparsing==2.4.7
|
||||||
multidict == 5.1.0
|
pytz==2021.3
|
||||||
packaging == 21.0
|
PyYAML==6.0
|
||||||
perky == 0.5.5
|
requests==2.26.0
|
||||||
pydantic == 1.8.2
|
resolvelib==0.5.4
|
||||||
pygments == 2.10.0
|
rstcheck==3.3.1
|
||||||
pyparsing == 2.4.7
|
semantic-version==2.8.5
|
||||||
pytz == 2021.1
|
sh==1.14.2
|
||||||
requests == 2.26.0
|
six==1.16.0
|
||||||
rstcheck == 3.3.1
|
snowballstemmer==2.1.0
|
||||||
semantic-version == 2.8.5
|
Sphinx==4.2.0
|
||||||
sh == 1.14.2
|
sphinx-ansible-theme==0.8.0
|
||||||
six == 1.16.0
|
sphinx-notfound-page==0.8
|
||||||
snowballstemmer == 2.1.0
|
sphinx-rtd-theme==1.0.0
|
||||||
sphinx-rtd-theme == 1.0.0
|
sphinxcontrib-applehelp==1.0.2
|
||||||
sphinxcontrib-applehelp == 1.0.2
|
sphinxcontrib-devhelp==1.0.2
|
||||||
sphinxcontrib-devhelp == 1.0.2
|
sphinxcontrib-htmlhelp==2.0.0
|
||||||
sphinxcontrib-htmlhelp == 2.0.0
|
sphinxcontrib-jsmath==1.0.1
|
||||||
sphinxcontrib-jsmath == 1.0.1
|
sphinxcontrib-qthelp==1.0.3
|
||||||
sphinxcontrib-qthelp == 1.0.3
|
sphinxcontrib-serializinghtml==1.1.5
|
||||||
sphinxcontrib-serializinghtml == 1.1.5
|
straight.plugin==1.5.0
|
||||||
twiggy == 0.5.1
|
Twiggy==0.5.1
|
||||||
typing-extensions == 3.10.0.2
|
typing-extensions==3.10.0.2
|
||||||
urllib3 == 1.26.6
|
urllib3==1.26.7
|
||||||
yarl == 1.6.3
|
yarl==1.7.2
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
docutils < 0.18 # match version required by sphinx in the docs-build sanity test
|
||||||
|
jinja2
|
||||||
|
pyyaml # ansible-core requirement
|
||||||
|
resolvelib < 0.6.0
|
||||||
|
rstcheck
|
||||||
|
straight.plugin
|
||||||
|
antsibull-changelog
|
@ -1,13 +1,12 @@
|
|||||||
docutils == 0.17.1
|
# edit "package-data.requirements.in" and generate with: hacking/update-sanity-requirements.py --test package-data
|
||||||
jinja2 == 3.0.1
|
antsibull-changelog==0.12.0
|
||||||
packaging == 21.0
|
docutils==0.17.1
|
||||||
pyyaml == 5.4.1 # ansible-core requirement
|
Jinja2==3.0.3
|
||||||
resolvelib == 0.5.4 # ansible-core requirement
|
MarkupSafe==2.0.1
|
||||||
rstcheck == 3.3.1
|
packaging==21.2
|
||||||
straight.plugin == 1.5.0
|
pyparsing==2.4.7
|
||||||
antsibull-changelog == 0.9.0
|
PyYAML==6.0
|
||||||
|
resolvelib==0.5.4
|
||||||
# dependencies
|
rstcheck==3.3.1
|
||||||
MarkupSafe == 2.0.1
|
semantic-version==2.8.5
|
||||||
pyparsing == 2.4.7
|
straight.plugin==1.5.0
|
||||||
semantic-version == 2.8.5
|
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
pyyaml
|
@ -1 +1,2 @@
|
|||||||
pyyaml == 5.4.1
|
# edit "release-names.requirements.in" and generate with: hacking/update-sanity-requirements.py --test release-names
|
||||||
|
PyYAML==6.0
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
sphinx == 4.2.0 # required for full rstcheck functionality, installed first to get the correct docutils version
|
||||||
|
rstcheck
|
||||||
|
jinja2 # ansible-core requirement
|
@ -1,27 +1,25 @@
|
|||||||
rstcheck == 3.3.1
|
# edit "rstcheck.requirements.in" and generate with: hacking/update-sanity-requirements.py --test rstcheck
|
||||||
sphinx == 2.1.2 # required for full functionality
|
alabaster==0.7.12
|
||||||
|
Babel==2.9.1
|
||||||
# dependencies
|
certifi==2021.10.8
|
||||||
Jinja2 == 3.0.1
|
charset-normalizer==2.0.7
|
||||||
MarkupSafe == 2.0.1
|
docutils==0.17.1
|
||||||
Pygments == 2.10.0
|
idna==3.3
|
||||||
alabaster == 0.7.12
|
imagesize==1.3.0
|
||||||
babel == 2.9.1
|
Jinja2==3.0.3
|
||||||
certifi == 2021.5.30
|
MarkupSafe==2.0.1
|
||||||
charset-normalizer == 2.0.5
|
packaging==21.2
|
||||||
docutils == 0.17.1
|
Pygments==2.10.0
|
||||||
idna == 2.5
|
pyparsing==2.4.7
|
||||||
imagesize == 1.2.0
|
pytz==2021.3
|
||||||
packaging == 21.0
|
requests==2.26.0
|
||||||
pyparsing == 2.4.7
|
rstcheck==3.3.1
|
||||||
pytz == 2021.1
|
snowballstemmer==2.1.0
|
||||||
requests == 2.26.0
|
Sphinx==4.2.0
|
||||||
rstcheck == 3.3.1
|
sphinxcontrib-applehelp==1.0.2
|
||||||
snowballstemmer == 2.1.0
|
sphinxcontrib-devhelp==1.0.2
|
||||||
sphinxcontrib-applehelp == 1.0.2
|
sphinxcontrib-htmlhelp==2.0.0
|
||||||
sphinxcontrib-devhelp == 1.0.2
|
sphinxcontrib-jsmath==1.0.1
|
||||||
sphinxcontrib-htmlhelp == 2.0.0
|
sphinxcontrib-qthelp==1.0.3
|
||||||
sphinxcontrib-jsmath == 1.0.1
|
sphinxcontrib-serializinghtml==1.1.5
|
||||||
sphinxcontrib-qthelp == 1.0.3
|
urllib3==1.26.7
|
||||||
sphinxcontrib-serializinghtml == 1.1.5
|
|
||||||
urllib3 == 1.26.6
|
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
packaging
|
@ -1,4 +1,3 @@
|
|||||||
packaging == 21.0
|
# edit "update-bundled.requirements.in" and generate with: hacking/update-sanity-requirements.py --test update-bundled
|
||||||
|
packaging==21.2
|
||||||
# dependencies
|
pyparsing==2.4.7
|
||||||
pyparsing == 2.4.7
|
|
||||||
|
Loading…
Reference in New Issue