From a9b58b84d8188e009ea6d4d25149927058d3bc2f Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Tue, 20 Feb 2018 08:51:01 -0800 Subject: [PATCH] Fix path handling in validate-modules sanity test. --- test/runner/lib/sanity/validate_modules.py | 17 ++++++----------- test/sanity/validate-modules/ignore.txt | 1 - 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/test/runner/lib/sanity/validate_modules.py b/test/runner/lib/sanity/validate_modules.py index 1491e38d2c..40c0758c15 100644 --- a/test/runner/lib/sanity/validate_modules.py +++ b/test/runner/lib/sanity/validate_modules.py @@ -17,7 +17,6 @@ from lib.util import ( SubprocessError, display, run_command, - deepest_path, ) from lib.ansible_util import ( @@ -45,10 +44,14 @@ class ValidateModulesTest(SanitySingleVersion): :type targets: SanityTargets :rtype: SanityResult """ + with open(VALIDATE_SKIP_PATH, 'r') as skip_fd: + skip_paths = skip_fd.read().splitlines() + + skip_paths_set = set(skip_paths) + env = ansible_environment(args, color=False) - paths = [deepest_path(i.path, 'lib/ansible/modules/') for i in targets.include_external] - paths = sorted(set(p for p in paths if p)) + paths = sorted([i.path for i in targets.include if i.module and i.path not in skip_paths_set]) if not paths: return SanitySkipped(self.name) @@ -60,9 +63,6 @@ class ValidateModulesTest(SanitySingleVersion): '--arg-spec', ] + paths - with open(VALIDATE_SKIP_PATH, 'r') as skip_fd: - skip_paths = skip_fd.read().splitlines() - invalid_ignores = [] with open(VALIDATE_IGNORE_PATH, 'r') as ignore_fd: @@ -81,11 +81,6 @@ class ValidateModulesTest(SanitySingleVersion): ignore[path][code] = line - skip_paths += [e.path for e in targets.exclude_external] - - if skip_paths: - cmd += ['--exclude', '^(%s)' % '|'.join(skip_paths)] - if args.base_branch: cmd.extend([ '--base-branch', args.base_branch, diff --git a/test/sanity/validate-modules/ignore.txt b/test/sanity/validate-modules/ignore.txt index 1fcebb6147..98f82ea9cf 100644 --- a/test/sanity/validate-modules/ignore.txt +++ b/test/sanity/validate-modules/ignore.txt @@ -2414,7 +2414,6 @@ lib/ansible/modules/network/nxos/nxos_bgp_neighbor_af.py E325 lib/ansible/modules/network/nxos/nxos_bgp_neighbor_af.py E326 lib/ansible/modules/network/nxos/nxos_command.py E325 lib/ansible/modules/network/nxos/nxos_command.py E326 -lib/ansible/modules/network/nxos/nxos_config.py E324 lib/ansible/modules/network/nxos/nxos_config.py E325 lib/ansible/modules/network/nxos/nxos_config.py E326 lib/ansible/modules/network/nxos/nxos_evpn_global.py E325