summaryrefslogtreecommitdiffhomepage
path: root/test/test_php_application.py
diff options
context:
space:
mode:
authorAndrei Zeliankou <zelenkov@nginx.com>2021-01-12 06:20:23 +0000
committerAndrei Zeliankou <zelenkov@nginx.com>2021-01-12 06:20:23 +0000
commitf5ac1432463e58873b2c801b6db64dbe4d0e8f1c (patch)
tree7bf4b98c915e2bb90372189d061dd8067e4bf7c5 /test/test_php_application.py
parenta0bc946db306b921fd2db909377e72bf6671e843 (diff)
downloadunit-f5ac1432463e58873b2c801b6db64dbe4d0e8f1c.tar.gz
unit-f5ac1432463e58873b2c801b6db64dbe4d0e8f1c.tar.bz2
Tests: unit_stop() removed where possible.
Since wait_for_record() was introduced there is no need to stop Unit before parsing unit.log.
Diffstat (limited to 'test/test_php_application.py')
-rw-r--r--test/test_php_application.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/test/test_php_application.py b/test/test_php_application.py
index ad74faa8..9f0da531 100644
--- a/test/test_php_application.py
+++ b/test/test_php_application.py
@@ -2,10 +2,10 @@ import os
import re
import shutil
import time
+from subprocess import call
import pytest
-from conftest import unit_stop
from unit.applications.lang.php import TestApplicationPHP
from unit.option import option
@@ -20,7 +20,7 @@ class TestPHPApplication(TestApplicationPHP):
def set_opcache(self, app, val):
assert 'success' in self.conf(
- {"admin": {"opcache.enable": val, "opcache.enable_cli": val,},},
+ {"admin": {"opcache.enable": val, "opcache.enable_cli": val}},
'applications/' + app + '/options',
)
@@ -99,7 +99,10 @@ class TestPHPApplication(TestApplicationPHP):
assert self.get()['body'] == '0123'
- unit_stop()
+ with open(temp_dir + '/unit.pid', 'r') as f:
+ pid = f.read().rstrip()
+
+ call(['kill', '-s', 'USR1', pid])
with open(temp_dir + '/unit.log', 'r', errors='ignore') as f:
errs = re.findall(r'Error in fastcgi_finish_request', f.read())
@@ -113,7 +116,10 @@ class TestPHPApplication(TestApplicationPHP):
assert resp['status'] == 200
assert resp['body'] == ''
- unit_stop()
+ with open(temp_dir + '/unit.pid', 'r') as f:
+ pid = f.read().rstrip()
+
+ call(['kill', '-s', 'USR1', pid])
with open(temp_dir + '/unit.log', 'r', errors='ignore') as f:
errs = re.findall(r'Error in fastcgi_finish_request', f.read())
@@ -538,8 +544,6 @@ class TestPHPApplication(TestApplicationPHP):
assert self.get()['status'] == 200, 'status 2'
- 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'