summaryrefslogtreecommitdiffhomepage
path: root/test/unit/check
diff options
context:
space:
mode:
authorAndrei Zeliankou <zelenkov@nginx.com>2023-02-21 17:21:29 +0000
committerAndrei Zeliankou <zelenkov@nginx.com>2023-02-21 17:21:29 +0000
commit7934dcabbc3c2b585e8d3f8fcee7020ba26f1687 (patch)
treebd0861e7832c14d92dd0ed9753932e58a2daf818 /test/unit/check
parentfcabbf09d85397e244f6486d6eca25e2366b61cd (diff)
downloadunit-7934dcabbc3c2b585e8d3f8fcee7020ba26f1687.tar.gz
unit-7934dcabbc3c2b585e8d3f8fcee7020ba26f1687.tar.bz2
Tests: switched to using f-strings.
Previously, it was necessary to support older versions of Python for compatibility. F-strings were released in Python 3.6. Python 3.5 was marked as unsupported by the end of 2020, so now it's possible to start using f-strings safely for better readability and performance.
Diffstat (limited to 'test/unit/check')
-rw-r--r--test/unit/check/chroot.py2
-rw-r--r--test/unit/check/isolation.py30
-rw-r--r--test/unit/check/node.py2
-rw-r--r--test/unit/check/unix_abstract.py2
4 files changed, 18 insertions, 18 deletions
diff --git a/test/unit/check/chroot.py b/test/unit/check/chroot.py
index 40b75058..1b7aae90 100644
--- a/test/unit/check/chroot.py
+++ b/test/unit/check/chroot.py
@@ -12,7 +12,7 @@ def check_chroot():
resp = http.put(
url='/config',
sock_type='unix',
- addr=option.temp_dir + '/control.unit.sock',
+ addr=f'{option.temp_dir}/control.unit.sock',
body=json.dumps(
{
"listeners": {"*:7080": {"pass": "routes"}},
diff --git a/test/unit/check/isolation.py b/test/unit/check/isolation.py
index 9bd835a3..4ebce893 100644
--- a/test/unit/check/isolation.py
+++ b/test/unit/check/isolation.py
@@ -27,8 +27,8 @@ def check_isolation():
"empty": {
"type": "external",
"processes": {"spare": 0},
- "working_directory": option.test_dir + "/go/empty",
- "executable": option.temp_dir + "/go/app",
+ "working_directory": f"{option.test_dir}/go/empty",
+ "executable": f"{option.test_dir}/go/app",
"isolation": {"namespaces": {"credential": True}},
},
},
@@ -41,8 +41,8 @@ def check_isolation():
"empty": {
"type": "python",
"processes": {"spare": 0},
- "path": option.test_dir + "/python/empty",
- "working_directory": option.test_dir + "/python/empty",
+ "path": f"{option.test_dir}/python/empty",
+ "working_directory": f"{option.test_dir}/python/empty",
"module": "wsgi",
"isolation": {"namespaces": {"credential": True}},
}
@@ -56,8 +56,8 @@ def check_isolation():
"phpinfo": {
"type": "php",
"processes": {"spare": 0},
- "root": option.test_dir + "/php/phpinfo",
- "working_directory": option.test_dir + "/php/phpinfo",
+ "root": f"{option.test_dir}/php/phpinfo",
+ "working_directory": f"{option.test_dir}/php/phpinfo",
"index": "index.php",
"isolation": {"namespaces": {"credential": True}},
}
@@ -73,8 +73,8 @@ def check_isolation():
"empty": {
"type": "ruby",
"processes": {"spare": 0},
- "working_directory": option.temp_dir + "/ruby/empty",
- "script": option.temp_dir + "/ruby/empty/config.ru",
+ "working_directory": f"{option.temp_dir}/ruby/empty",
+ "script": f"{option.temp_dir}/ruby/empty/config.ru",
"isolation": {"namespaces": {"credential": True}},
}
},
@@ -87,11 +87,11 @@ def check_isolation():
"listeners": {"*:7080": {"pass": "applications/empty"}},
"applications": {
"empty": {
- "unit_jars": option.current_dir + "/build",
+ "unit_jars": f"{option.current_dir}/build",
"type": "java",
"processes": {"spare": 0},
- "working_directory": option.test_dir + "/java/empty/",
- "webapp": option.temp_dir + "/java",
+ "working_directory": f"{option.temp_dir}/java/empty/",
+ "webapp": f"{option.temp_dir}/java",
"isolation": {"namespaces": {"credential": True}},
}
},
@@ -106,7 +106,7 @@ def check_isolation():
"basic": {
"type": "external",
"processes": {"spare": 0},
- "working_directory": option.temp_dir + "/node",
+ "working_directory": f"{option.temp_dir}/node",
"executable": "app.js",
"isolation": {"namespaces": {"credential": True}},
}
@@ -120,8 +120,8 @@ def check_isolation():
"body_empty": {
"type": "perl",
"processes": {"spare": 0},
- "working_directory": option.test_dir + "/perl/body_empty",
- "script": option.test_dir + "/perl/body_empty/psgi.pl",
+ "working_directory": f"{option.test_dir}/perl/body_empty",
+ "script": f"{option.test_dir}/perl/body_empty/psgi.pl",
"isolation": {"namespaces": {"credential": True}},
}
},
@@ -133,7 +133,7 @@ def check_isolation():
resp = http.put(
url='/config',
sock_type='unix',
- addr=option.temp_dir + '/control.unit.sock',
+ addr=f'{option.temp_dir}/control.unit.sock',
body=json.dumps(conf),
)
diff --git a/test/unit/check/node.py b/test/unit/check/node.py
index e053a749..dd59e7a4 100644
--- a/test/unit/check/node.py
+++ b/test/unit/check/node.py
@@ -3,7 +3,7 @@ import subprocess
def check_node(current_dir):
- if not os.path.exists(current_dir + '/node/node_modules'):
+ if not os.path.exists(f'{current_dir}/node/node_modules'):
return None
try:
diff --git a/test/unit/check/unix_abstract.py b/test/unit/check/unix_abstract.py
index 5d1f629e..aadde43a 100644
--- a/test/unit/check/unix_abstract.py
+++ b/test/unit/check/unix_abstract.py
@@ -12,7 +12,7 @@ def check_unix_abstract():
resp = http.put(
url='/config',
sock_type='unix',
- addr=option.temp_dir + '/control.unit.sock',
+ addr=f'{option.temp_dir}/control.unit.sock',
body=json.dumps(
{
"listeners": {"unix:@sock": {"pass": "routes"}},