From c8c259b9728c57e70042d7630045e5b043f46e5b Mon Sep 17 00:00:00 2001 From: Andrey Zelenkov Date: Tue, 6 Aug 2019 18:25:13 +0300 Subject: Tests: rerun tests for each module version. Rerun supported for Python, PHP, Perl, Ruby, and Java modules. --- test/unit/main.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'test/unit/main.py') diff --git a/test/unit/main.py b/test/unit/main.py index 49806fe7..212da49e 100644 --- a/test/unit/main.py +++ b/test/unit/main.py @@ -12,6 +12,8 @@ import subprocess from multiprocessing import Process +available_modules = {} + class TestUnit(unittest.TestCase): current_dir = os.path.abspath( @@ -34,6 +36,17 @@ class TestUnit(unittest.TestCase): TestUnit._set_args(args) + def run(self, result=None): + if not hasattr(self, 'application_type'): + return super().run(result) + + type = self.application_type + for prerequisite in self.prerequisites: + if prerequisite in available_modules: + for version in available_modules[prerequisite]: + self.application_type = type + ' ' + version + super().run(result) + @classmethod def main(cls): args, rest = TestUnit._parse_args() @@ -108,6 +121,16 @@ class TestUnit(unittest.TestCase): self.stop() exit("Unit is writing log too long") + # discover all available modules + + global available_modules + available_modules = {} + for module in re.findall(r'module: ([a-zA-Z]+) ([\d\.]*) ', log): + if module[0] not in available_modules: + available_modules[module[0]] = [module[1]] + else: + available_modules[module[0]].append(module[1]) + missed_module = '' for module in modules: if module == 'go': @@ -153,7 +176,8 @@ class TestUnit(unittest.TestCase): m = None else: - m = re.search('module: ' + module, log) + if module not in available_modules: + m = None if m is None: missed_module = module -- cgit From 78fbf9ee60a1cf4306a65c15ecce8dafbe6bf862 Mon Sep 17 00:00:00 2001 From: Andrey Zelenkov Date: Thu, 8 Aug 2019 15:47:26 +0300 Subject: Tests: fixed modules version parsing. --- test/unit/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/unit/main.py') diff --git a/test/unit/main.py b/test/unit/main.py index 212da49e..27f8bff9 100644 --- a/test/unit/main.py +++ b/test/unit/main.py @@ -125,7 +125,7 @@ class TestUnit(unittest.TestCase): global available_modules available_modules = {} - for module in re.findall(r'module: ([a-zA-Z]+) ([\d\.]*) ', log): + for module in re.findall(r'module: ([a-zA-Z]+) (.*) ".*"$', log, re.M): if module[0] not in available_modules: available_modules[module[0]] = [module[1]] else: -- cgit From 08601bbbf07a462924e4c6894b5fd6e83b7725ac Mon Sep 17 00:00:00 2001 From: Andrey Zelenkov Date: Thu, 22 Aug 2019 15:26:15 +0300 Subject: Tests: "--unsafe" option introduced. --- test/unit/main.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/unit/main.py') diff --git a/test/unit/main.py b/test/unit/main.py index 27f8bff9..1f19343e 100644 --- a/test/unit/main.py +++ b/test/unit/main.py @@ -333,6 +333,13 @@ class TestUnit(unittest.TestCase): action='store_true', help='Save unit.log after the test execution', ) + parser.add_argument( + '-u', + '--unsafe', + dest='unsafe', + action='store_true', + help='Run unsafe tests', + ) return parser.parse_known_args() @@ -340,6 +347,7 @@ class TestUnit(unittest.TestCase): def _set_args(args): TestUnit.detailed = args.detailed TestUnit.save_log = args.save_log + TestUnit.unsafe = args.unsafe if TestUnit.detailed: fcntl.fcntl(sys.stdout.fileno(), fcntl.F_SETFL, 0) -- cgit From 9bbf54e23e185e94054072fff2673f6f5cd203e9 Mon Sep 17 00:00:00 2001 From: Andrey Zelenkov Date: Thu, 22 Aug 2019 15:33:41 +0300 Subject: Tests: Node.js websockets. --- test/unit/main.py | 1 + 1 file changed, 1 insertion(+) (limited to 'test/unit/main.py') diff --git a/test/unit/main.py b/test/unit/main.py index 1f19343e..6a167a9e 100644 --- a/test/unit/main.py +++ b/test/unit/main.py @@ -23,6 +23,7 @@ class TestUnit(unittest.TestCase): os.path.join(os.path.dirname(__file__), os.pardir, os.pardir) ) architecture = platform.architecture()[0] + system = platform.system() maxDiff = None detailed = False -- cgit