diff options
author | Andrey Zelenkov <zelenkov@nginx.com> | 2019-08-06 18:25:13 +0300 |
---|---|---|
committer | Andrey Zelenkov <zelenkov@nginx.com> | 2019-08-06 18:25:13 +0300 |
commit | c8c259b9728c57e70042d7630045e5b043f46e5b (patch) | |
tree | 7ecd61a159c154ab4299fa9e07c7b500dc0a6e67 /test/unit/main.py | |
parent | 274260bd2824f11d5007587e0f3bf897149d7107 (diff) | |
download | unit-c8c259b9728c57e70042d7630045e5b043f46e5b.tar.gz unit-c8c259b9728c57e70042d7630045e5b043f46e5b.tar.bz2 |
Tests: rerun tests for each module version.
Rerun supported for Python, PHP, Perl, Ruby, and Java modules.
Diffstat (limited to '')
-rw-r--r-- | test/unit/main.py | 26 |
1 files changed, 25 insertions, 1 deletions
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 |