From a3699557a3e4605788bb02a34de8a7979ec96629 Mon Sep 17 00:00:00 2001 From: Andrei Zeliankou Date: Thu, 30 Jun 2022 14:40:17 +0100 Subject: Tests: minor improvements. Added "go" availability check before trying to build an application. update_action() method used were possible and fixed bug with the relative path determination in test_static_chroot.py. Templates optimization and style fixes. --- test/unit/applications/proto.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/unit/applications/proto.py') diff --git a/test/unit/applications/proto.py b/test/unit/applications/proto.py index cd8672ba..6ba7b9b8 100644 --- a/test/unit/applications/proto.py +++ b/test/unit/applications/proto.py @@ -13,7 +13,7 @@ class TestApplicationProto(TestControl): def sec_epoch(self): return time.mktime(time.gmtime()) - def date_to_sec_epoch(self, date, template='%a, %d %b %Y %H:%M:%S %Z'): + def date_to_sec_epoch(self, date, template='%a, %d %b %Y %X %Z'): return time.mktime(time.strptime(date, template)) def findall(self, pattern, name='unit.log'): -- cgit From 69e690affe94eb37308d1eb551b34cd32323aae1 Mon Sep 17 00:00:00 2001 From: Andrei Zeliankou Date: Thu, 28 Jul 2022 14:12:19 +0100 Subject: Tests: added flags to search functions in proto.py. Also removed unnesessary re.compile() calls. --- test/unit/applications/proto.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'test/unit/applications/proto.py') diff --git a/test/unit/applications/proto.py b/test/unit/applications/proto.py index 6ba7b9b8..f04ee408 100644 --- a/test/unit/applications/proto.py +++ b/test/unit/applications/proto.py @@ -16,18 +16,18 @@ class TestApplicationProto(TestControl): def date_to_sec_epoch(self, date, template='%a, %d %b %Y %X %Z'): return time.mktime(time.strptime(date, template)) - def findall(self, pattern, name='unit.log'): + def findall(self, pattern, name='unit.log', flags=re.M): with Log.open(name) as f: - return re.findall(pattern, f.read()) + return re.findall(pattern, f.read(), flags) - def search_in_log(self, pattern, name='unit.log'): + def search_in_log(self, pattern, name='unit.log', flags=re.M): with Log.open(name) as f: - return re.search(pattern, f.read()) + return re.search(pattern, f.read(), flags) - def wait_for_record(self, pattern, name='unit.log', wait=150): + def wait_for_record(self, pattern, name='unit.log', wait=150, flags=re.M): with Log.open(name) as f: for i in range(wait): - found = re.search(pattern, f.read()) + found = re.search(pattern, f.read(), flags) if found is not None: break -- cgit