summaryrefslogtreecommitdiffhomepage
path: root/test/test_asgi_lifespan.py
diff options
context:
space:
mode:
authorKonstantin Pavlov <thresh@nginx.com>2023-05-10 10:29:16 -0700
committerKonstantin Pavlov <thresh@nginx.com>2023-05-10 10:29:16 -0700
commit69235c513277c64b513447d9b92c3c03d616f577 (patch)
tree0780c92ba28d92b547c85ea0bee5e3040e14dee2 /test/test_asgi_lifespan.py
parentb9bc222021e77bbdfb12576b3e315b962cf6b399 (diff)
parentfaf97dc06058de1c929af33a68adb34d3932b374 (diff)
downloadunit-1.30.0-1.tar.gz
unit-1.30.0-1.tar.bz2
Merged with the default branch.1.30.0-1
Diffstat (limited to '')
-rw-r--r--test/test_asgi_lifespan.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/test/test_asgi_lifespan.py b/test/test_asgi_lifespan.py
index e295f7fa..84e9fea4 100644
--- a/test/test_asgi_lifespan.py
+++ b/test/test_asgi_lifespan.py
@@ -15,25 +15,25 @@ class TestASGILifespan(TestApplicationPython):
load_module = 'asgi'
def setup_cookies(self, prefix):
- base_dir = option.test_dir + '/python/lifespan/empty'
+ base_dir = f'{option.test_dir}/python/lifespan/empty'
os.chmod(base_dir, 0o777)
for name in ['startup', 'shutdown', 'version']:
- path = option.test_dir + '/python/lifespan/empty/' + prefix + name
+ path = f'{option.test_dir}/python/lifespan/empty/{prefix}{name}'
open(path, 'a').close()
os.chmod(path, 0o777)
def assert_cookies(self, prefix):
for name in ['startup', 'shutdown']:
- path = option.test_dir + '/python/lifespan/empty/' + prefix + name
+ path = f'{option.test_dir}/python/lifespan/empty/{prefix}{name}'
exists = os.path.isfile(path)
if exists:
os.remove(path)
assert not exists, name
- path = option.test_dir + '/python/lifespan/empty/' + prefix + 'version'
+ path = f'{option.test_dir}/python/lifespan/empty/{prefix}version'
with open(path, 'r') as f:
version = f.read()
@@ -54,6 +54,8 @@ class TestASGILifespan(TestApplicationPython):
self.assert_cookies('')
def test_asgi_lifespan_targets(self):
+ path = f'{option.test_dir}/python/lifespan/empty'
+
assert 'success' in self.conf(
{
"listeners": {"*:7080": {"pass": "routes"}},
@@ -71,9 +73,8 @@ class TestASGILifespan(TestApplicationPython):
"targets": {
"type": self.get_application_type(),
"processes": {"spare": 0},
- "working_directory": option.test_dir
- + "/python/lifespan/empty",
- "path": option.test_dir + '/python/lifespan/empty',
+ "working_directory": path,
+ "path": path,
"targets": {
"1": {"module": "asgi", "callable": "application"},
"2": {