diff options
Diffstat (limited to 'test/test_usr1.py')
-rw-r--r-- | test/test_usr1.py | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/test/test_usr1.py b/test/test_usr1.py index 2e48c18f..3e44e4c5 100644 --- a/test/test_usr1.py +++ b/test/test_usr1.py @@ -1,6 +1,7 @@ import os from subprocess import call +from conftest import unit_stop from conftest import waitforfiles from unit.applications.lang.python import TestApplicationPython @@ -8,12 +9,12 @@ from unit.applications.lang.python import TestApplicationPython class TestUSR1(TestApplicationPython): prerequisites = {'modules': {'python': 'any'}} - def test_usr1_access_log(self): + def test_usr1_access_log(self, temp_dir): self.load('empty') log = 'access.log' log_new = 'new.log' - log_path = self.temp_dir + '/' + log + log_path = temp_dir + '/' + log assert 'success' in self.conf( '"' + log_path + '"', 'access_log' @@ -21,7 +22,7 @@ class TestUSR1(TestApplicationPython): assert waitforfiles(log_path), 'open' - os.rename(log_path, self.temp_dir + '/' + log_new) + os.rename(log_path, temp_dir + '/' + log_new) assert self.get()['status'] == 200 @@ -31,7 +32,7 @@ class TestUSR1(TestApplicationPython): ), 'rename new' assert not os.path.isfile(log_path), 'rename old' - with open(self.temp_dir + '/unit.pid', 'r') as f: + with open(temp_dir + '/unit.pid', 'r') as f: pid = f.read().rstrip() call(['kill', '-s', 'USR1', pid]) @@ -40,7 +41,7 @@ class TestUSR1(TestApplicationPython): assert self.get(url='/usr1')['status'] == 200 - self.stop() + unit_stop() assert ( self.wait_for_record(r'"GET /usr1 HTTP/1.1" 200 0 "-" "-"', log) @@ -48,12 +49,12 @@ class TestUSR1(TestApplicationPython): ), 'reopen 2' assert self.search_in_log(r'/usr1', log_new) is None, 'rename new 2' - def test_usr1_unit_log(self): + def test_usr1_unit_log(self, temp_dir): self.load('log_body') log_new = 'new.log' - log_path = self.temp_dir + '/unit.log' - log_path_new = self.temp_dir + '/' + log_new + log_path = temp_dir + '/unit.log' + log_path_new = temp_dir + '/' + log_new os.rename(log_path, log_path_new) @@ -63,7 +64,7 @@ class TestUSR1(TestApplicationPython): assert self.wait_for_record(body, log_new) is not None, 'rename new' assert not os.path.isfile(log_path), 'rename old' - with open(self.temp_dir + '/unit.pid', 'r') as f: + with open(temp_dir + '/unit.pid', 'r') as f: pid = f.read().rstrip() call(['kill', '-s', 'USR1', pid]) @@ -73,7 +74,7 @@ class TestUSR1(TestApplicationPython): body = 'body_for_a_log_unit' assert self.post(body=body)['status'] == 200 - self.stop() + unit_stop() assert self.wait_for_record(body) is not None, 'rename new' assert self.search_in_log(body, log_new) is None, 'rename new 2' |