mirror of https://github.com/ansible/ansible.git
Import sanity test for plugins (#72497)
parent
4059b37ab1
commit
1f3a90270b
@ -0,0 +1,2 @@
|
||||
minor_changes:
|
||||
- "ansible-test - the ``import`` sanity test now also tries to import all non-module and non-module_utils Python files in ``lib/ansible/`` resp. ``plugins/`` (https://github.com/ansible/ansible/pull/72497)."
|
||||
@ -0,0 +1,4 @@
|
||||
ansible-requirements
|
||||
====================
|
||||
|
||||
``test/lib/ansible_test/_data/requirements/sanity.import-plugins.txt`` must be an identical copy of ``requirements.txt`` found in the project's root.
|
||||
@ -0,0 +1,13 @@
|
||||
# Note: this requirements.txt file is used to specify what dependencies are
|
||||
# needed to make the package run rather than for deployment of a tested set of
|
||||
# packages. Thus, this should be the loosest set possible (only required
|
||||
# packages, not optional ones, and with the widest range of versions that could
|
||||
# be suitable)
|
||||
jinja2
|
||||
PyYAML
|
||||
cryptography
|
||||
packaging
|
||||
# NOTE: resolvelib 0.x version bumps should be considered major/breaking
|
||||
# NOTE: and we should update the upper cap with care, at least until 1.0
|
||||
# NOTE: Ref: https://github.com/sarugaku/resolvelib/issues/69
|
||||
resolvelib >= 0.5.3, < 0.6.0 # dependency resolver used by ansible-galaxy
|
||||
@ -0,0 +1,7 @@
|
||||
{
|
||||
"prefixes": [
|
||||
"requirements.txt",
|
||||
"test/lib/ansible_test/_data/requirements/sanity.import-plugins.txt"
|
||||
],
|
||||
"output": "path-line-column-message"
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import re
|
||||
import sys
|
||||
|
||||
|
||||
def read_file(path):
|
||||
try:
|
||||
with open(path, 'r') as f:
|
||||
return f.read()
|
||||
except Exception as ex: # pylint: disable=broad-except
|
||||
print('%s:%d:%d: unable to read required file %s' % (path, 0, 0, re.sub(r'\s+', ' ', str(ex))))
|
||||
return None
|
||||
|
||||
|
||||
def main():
|
||||
ORIGINAL_FILE = 'requirements.txt'
|
||||
VENDORED_COPY = 'test/lib/ansible_test/_data/requirements/sanity.import-plugins.txt'
|
||||
|
||||
original_requirements = read_file(ORIGINAL_FILE)
|
||||
vendored_requirements = read_file(VENDORED_COPY)
|
||||
|
||||
if original_requirements is not None and vendored_requirements is not None:
|
||||
if original_requirements != vendored_requirements:
|
||||
print('%s:%d:%d: must be identical to %s' % (VENDORED_COPY, 0, 0, ORIGINAL_FILE))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Loading…
Reference in New Issue