diff options
Diffstat (limited to 'test/unit/applications/proto.py')
-rw-r--r-- | test/unit/applications/proto.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/test/unit/applications/proto.py b/test/unit/applications/proto.py index 244cb5be..2f748c21 100644 --- a/test/unit/applications/proto.py +++ b/test/unit/applications/proto.py @@ -1,6 +1,8 @@ +import os import re import time +from conftest import option from unit.control import TestControl @@ -12,7 +14,7 @@ class TestApplicationProto(TestControl): return time.mktime(time.strptime(date, template)) def search_in_log(self, pattern, name='unit.log'): - with open(self.testdir + '/' + name, 'r', errors='ignore') as f: + with open(self.temp_dir + '/' + name, 'r', errors='ignore') as f: return re.search(pattern, f.read()) def wait_for_record(self, pattern, name='unit.log'): @@ -26,6 +28,16 @@ class TestApplicationProto(TestControl): return found + def get_appication_type(self): + current_test = ( + os.environ.get('PYTEST_CURRENT_TEST').split(':')[-1].split(' ')[0] + ) + + if current_test in option.generated_tests: + return option.generated_tests[current_test] + + return None + def _load_conf(self, conf, **kwargs): if 'applications' in conf: for app in conf['applications'].keys(): @@ -39,6 +51,4 @@ class TestApplicationProto(TestControl): if 'isolation' in kwargs: app_conf['isolation'] = kwargs['isolation'] - self.assertIn( - 'success', self.conf(conf), 'load application configuration' - ) + assert 'success' in self.conf(conf), 'load application configuration' |