summaryrefslogtreecommitdiffhomepage
path: root/test/test_php_application.py
diff options
context:
space:
mode:
authorAndrei Zeliankou <zelenkov@nginx.com>2020-10-19 22:25:29 +0100
committerAndrei Zeliankou <zelenkov@nginx.com>2020-10-19 22:25:29 +0100
commit54837759f36eddb80af22c8d73e103a948221dc7 (patch)
tree420c6ce21ad3868db4037d160406f7754bb392e5 /test/test_php_application.py
parentd8628a43d0705deeb3473faf0252288038defc2b (diff)
downloadunit-54837759f36eddb80af22c8d73e103a948221dc7.tar.gz
unit-54837759f36eddb80af22c8d73e103a948221dc7.tar.bz2
Tests: fixed unit.log print.
Diffstat (limited to 'test/test_php_application.py')
-rw-r--r--test/test_php_application.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/test/test_php_application.py b/test/test_php_application.py
index 063d3e0c..f1a9e293 100644
--- a/test/test_php_application.py
+++ b/test/test_php_application.py
@@ -6,6 +6,7 @@ import time
import pytest
from conftest import option
+from conftest import unit_stop
from unit.applications.lang.php import TestApplicationPHP
class TestPHPApplication(TestApplicationPHP):
@@ -444,7 +445,7 @@ class TestPHPApplication(TestApplicationPHP):
r'012345', self.get()['body']
), 'disable_classes before'
- def test_php_application_error_log(self):
+ def test_php_application_error_log(self, temp_dir):
self.load('error_log')
assert self.get()['status'] == 200, 'status'
@@ -453,13 +454,13 @@ class TestPHPApplication(TestApplicationPHP):
assert self.get()['status'] == 200, 'status 2'
- self.stop()
+ unit_stop()
pattern = r'\d{4}\/\d\d\/\d\d\s\d\d:.+\[notice\].+Error in application'
assert self.wait_for_record(pattern) is not None, 'errors print'
- with open(self.temp_dir + '/unit.log', 'r', errors='ignore') as f:
+ with open(temp_dir + '/unit.log', 'r', errors='ignore') as f:
errs = re.findall(pattern, f.read())
assert len(errs) == 2, 'error_log count'
@@ -507,12 +508,12 @@ class TestPHPApplication(TestApplicationPHP):
assert resp['status'] == 200, 'status'
assert resp['body'] != '', 'body not empty'
- def test_php_application_extension_check(self):
+ def test_php_application_extension_check(self, temp_dir):
self.load('phpinfo')
assert self.get(url='/index.wrong')['status'] != 200, 'status'
- new_root = self.temp_dir + "/php"
+ new_root = temp_dir + "/php"
os.mkdir(new_root)
shutil.copy(option.test_dir + '/php/phpinfo/index.wrong', new_root)