Bug 1410969 - Properly import AutoTry; r?ahal
The AutoTry code got moved around in 27b5181a3c77 and c94bf66df122
(
bug 1382775). This broke `mach test` without arguments.
This commit imports the new location and uses the new API. As the
inline TODO states, there is still room for improvement. This will
be done in a separate commit.
MozReview-Commit-ID: AKHfdNnfOhl
--- a/testing/mach_commands.py
+++ b/testing/mach_commands.py
@@ -249,26 +249,25 @@ class Test(MachCommandBase):
relpath = self._wrap_path_argument(entry).relpath()
tests = list(resolver.resolve_tests(paths=[relpath]))
run_tests.extend(tests)
if not tests:
print('UNKNOWN TEST: %s' % entry, file=sys.stderr)
if not what:
- # TODO: This isn't really related to try, and should be
- # extracted to a common library for vcs interactions when it is
- # introduced in bug 1185599.
- from autotry import AutoTry
+ from tryselect.selectors.syntax import AutoTry
at = AutoTry(self.topsrcdir, resolver, self._mach_context)
- changed_files = at.find_changed_files()
+ changed_files, changed_tags = at.find_paths_and_tags(
+ False, detect_paths=True)
if changed_files:
print("Tests will be run based on modifications to the "
"following files:\n\t%s" % "\n\t".join(changed_files))
+ # TODO this code is redundant with what `find_paths_and_tags` does.
reader = self.mozbuild_reader(config_mode='empty')
files_info = reader.files_info(changed_files)
paths, tags, flavors = set(), set(), set()
for info in files_info.values():
paths |= info.test_files
tags |= info.test_tags
flavors |= info.test_flavors