uitest: improve conditional test suppression to limit by class and by function

Example:

make UITest_writerperfect_epubexport UITEST_TEST_NAME="epubexport.EPUBExportTest.testUIComponent"

Change-Id: I7960a71574d8d3d9cb06399813c7370700579c3d
Reviewed-on: https://gerrit.libreoffice.org/49246
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
This commit is contained in:
Miklos Vajna
2018-02-05 15:33:29 +01:00
parent 03cee02464
commit 420b80a7d6

View File

@@ -69,8 +69,6 @@ def add_tests_for_file(test_file, test_suite):
test_name_limit = os.environ.get('UITEST_TEST_NAME', '')
test_loader = unittest.TestLoader()
module_name = os.path.splitext(os.path.split(test_file)[1])[0]
if len(test_name_limit) > 0 and not test_name_limit.startswith(module_name):
return
loader = importlib.machinery.SourceFileLoader(module_name, test_file)
mod = loader.load_module()
@@ -78,6 +76,10 @@ def add_tests_for_file(test_file, test_suite):
for c in classes:
test_names = test_loader.getTestCaseNames(c)
for test_name in test_names:
full_name = ".".join([module_name, c.__name__, test_name])
if len(test_name_limit) > 0 and not test_name_limit.startswith(full_name):
continue
obj = c(test_name, opts)
test_suite.addTest(obj)