1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Relocate module unit tests. (#18812)

* Relocate module unit tests.
* Fix classification of unit test changes.
This commit is contained in:
Matt Clay 2016-12-06 23:07:58 -05:00
parent 573078fc6b
commit 5628e260f2
15 changed files with 12 additions and 4 deletions

View file

@ -81,7 +81,7 @@ class PathMapper(object):
self.compile_paths = set(t.path for t in self.compile_targets) self.compile_paths = set(t.path for t in self.compile_targets)
self.units_modules = set(t.module for t in self.units_targets if t.module) self.units_modules = set(t.module for t in self.units_targets if t.module)
self.units_paths = set(t.path for t in self.units_targets) self.units_paths = set(a for t in self.units_targets for a in t.aliases)
self.sanity_paths = set(t.path for t in self.sanity_targets) self.sanity_paths = set(t.path for t in self.sanity_targets)
self.module_names_by_path = dict((t.path, t.module) for t in self.module_targets) self.module_names_by_path = dict((t.path, t.module) for t in self.module_targets)
@ -280,9 +280,17 @@ class PathMapper(object):
'units': path, 'units': path,
} }
return { # changes to files which are not unit tests should trigger tests from the nearest parent directory
'units': '%s/' % os.path.dirname(path),
} test_path = os.path.dirname(path)
while test_path:
if test_path + '/' in self.units_paths:
return {
'units': test_path + '/',
}
test_path = os.path.dirname(test_path)
if path.startswith('test/runner/'): if path.startswith('test/runner/'):
return all_tests() # test infrastructure, run all tests return all_tests() # test infrastructure, run all tests