From 13d08d232c8b692ec79dba81c9eb83887ee554a2 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Tue, 26 Jan 2021 13:30:44 -0800 Subject: [PATCH] Rename ansible-test functions to match constants. --- changelogs/fragments/ansible-test-code-naming.yml | 2 ++ .../validate-modules/validate_modules/main.py | 14 +++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) create mode 100644 changelogs/fragments/ansible-test-code-naming.yml diff --git a/changelogs/fragments/ansible-test-code-naming.yml b/changelogs/fragments/ansible-test-code-naming.yml new file mode 100644 index 00000000000..fb462b9ff0d --- /dev/null +++ b/changelogs/fragments/ansible-test-code-naming.yml @@ -0,0 +1,2 @@ +minor_changes: + - ansible-test - Rename internal functions to match associated constant names that were previously updated. diff --git a/test/lib/ansible_test/_data/sanity/validate-modules/validate_modules/main.py b/test/lib/ansible_test/_data/sanity/validate-modules/validate_modules/main.py index 2e0e5d0799e..921c43e1fb9 100644 --- a/test/lib/ansible_test/_data/sanity/validate-modules/validate_modules/main.py +++ b/test/lib/ansible_test/_data/sanity/validate-modules/validate_modules/main.py @@ -495,7 +495,7 @@ class ModuleValidator(Validator): column=(os_call_match.span()[0] + 1) ) - def _find_blacklist_imports(self): + def _find_rejectlist_imports(self): for child in self.ast.body: names = [] if isinstance(child, ast.Import): @@ -509,8 +509,8 @@ class ModuleValidator(Validator): names.extend(grandchild.names) for name in names: # TODO: Add line/col - for blacklist_import, options in REJECTLIST_IMPORTS.items(): - if re.search(blacklist_import, name.name): + for rejectlist_import, options in REJECTLIST_IMPORTS.items(): + if re.search(rejectlist_import, name.name): new_only = options['new_only'] if self._is_new_module() and new_only: self.reporter.error( @@ -2093,7 +2093,7 @@ class ModuleValidator(Validator): return existing_doc @staticmethod - def is_blacklisted(path): + def is_on_rejectlist(path): base_name = os.path.basename(path) file_name = os.path.splitext(base_name)[0] @@ -2186,7 +2186,7 @@ class ModuleValidator(Validator): if self._python_module() and not self._just_docs() and not end_of_deprecation_should_be_removed_only: self._validate_ansible_module_call(docs) self._check_for_sys_exit() - self._find_blacklist_imports() + self._find_rejectlist_imports() main = self._find_main_call() self._find_module_utils(main) self._find_has_import() @@ -2329,7 +2329,7 @@ def run(): path = module if args.exclude and args.exclude.search(path): continue - if ModuleValidator.is_blacklisted(path): + if ModuleValidator.is_on_rejectlist(path): continue with ModuleValidator(path, collection=args.collection, collection_version=args.collection_version, analyze_arg_spec=args.arg_spec, base_branch=args.base_branch, @@ -2353,7 +2353,7 @@ def run(): path = os.path.join(root, filename) if args.exclude and args.exclude.search(path): continue - if ModuleValidator.is_blacklisted(path): + if ModuleValidator.is_on_rejectlist(path): continue with ModuleValidator(path, collection=args.collection, collection_version=args.collection_version, analyze_arg_spec=args.arg_spec, base_branch=args.base_branch,