From 470948a0d65fb65ff58fc185af12e5ece8e1ae4c Mon Sep 17 00:00:00 2001 From: Andrey Zelenkov Date: Wed, 10 Jan 2018 20:35:22 +0300 Subject: Tests: style. --- test/unit.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'test/unit.py') diff --git a/test/unit.py b/test/unit.py index 3d331b46..9b3f76ef 100644 --- a/test/unit.py +++ b/test/unit.py @@ -41,16 +41,18 @@ class TestUnit(unittest.TestCase): if m is None: exit("Unit is writing log too long") - ret = '' + missed_module = '' for module in modules: m = re.search('module: ' + module, log, re.M | re.S) if m is None: - ret = module + missed_module = module + break self._stop() shutil.rmtree(self.testdir) - return ret + if missed_module: + raise unittest.SkipTest('Unit has no ' + missed_module + ' module') def _run(self): self.testdir = tempfile.mkdtemp(prefix='unit-test-') @@ -131,7 +133,6 @@ class TestUnitControl(TestUnit): # TODO http client def http(self, req): - with self._control_sock() as sock: sock.sendall(req) @@ -146,21 +147,18 @@ class TestUnitControl(TestUnit): return resp def get(self, path='/'): - resp = self.http(('GET ' + path + ' HTTP/1.1\r\nHost: localhost\r\n\r\n').encode()) return self._body_json(resp) def delete(self, path='/'): - resp = self.http(('DELETE ' + path + ' HTTP/1.1\r\nHost: localhost\r\n\r\n').encode()) return self._body_json(resp) def put(self, path='/', data=''): - if isinstance(data, str): data = data.encode() -- cgit