return
tests_names = [test.classname for test in tests]
+ testlist_changed = False
for testsuite in self.options.testsuites:
if not self._check_tester_has_other_testsuite(testsuite, tester) \
and tester.check_testslist:
for test in know_tests:
if test and test not in tests_names:
+ testlist_changed = True
printc("Test %s Not in testsuite %s anymore"
% (test, testsuite.__file__), Colors.FAIL)
if test and test not in know_tests:
printc("Test %s is NEW in testsuite %s"
% (test, testsuite.__file__), Colors.OKGREEN)
+ testlist_changed = True
testlist_file.close()
- return
+ break
+
+ return testlist_changed
def list_tests(self):
for tester in self.testers:
tests = tester.list_tests()
- self._check_defined_tests(tester, tests)
+ if self._check_defined_tests(tester, tests) and \
+ self.options.fail_on_testlist_change:
+ return -1
+
self.tests.extend(tests)
return sorted(list(self.tests))
parser.add_argument("-F", "--fatal-error", dest="fatal_error",
action="store_true",
help="Stop on first fail")
+ parser.add_argument("--fail-on-testlist-change",
+ dest="fail_on_testlist_change",
+ action="store_true",
+ help="Fail the testsuite if a test has been added"
+ " or removed without being explicitely added/removed "
+ "from the testlist file.")
parser.add_argument("-t", "--wanted-tests", dest="wanted_tests",
action="append",
help="Define the tests to execute, it can be a regex."
# Ensure that the scenario manager singleton is ready to be used
ScenarioManager().config = options
tests_launcher.set_settings(options, [])
- tests_launcher.list_tests()
+ if tests_launcher.list_tests() == -1:
+ printc("\nFailling as tests have been removed/added "
+ " (--fail-on-testlist-change)", Colors.FAIL)
+ exit(1)
if options.list_tests:
l = tests_launcher.tests