diff options
author | Andrei Zeliankou <zelenkov@nginx.com> | 2021-10-18 01:10:11 +0100 |
---|---|---|
committer | Andrei Zeliankou <zelenkov@nginx.com> | 2021-10-18 01:10:11 +0100 |
commit | 39adb292d54403d17f86f6852e87b0bda1d49946 (patch) | |
tree | 7fa2af8711216ed81bbf60531d990acd3a6f1013 | |
parent | 78a4063063b8f810a616d74a358ef150faff96db (diff) | |
download | unit-39adb292d54403d17f86f6852e87b0bda1d49946.tar.gz unit-39adb292d54403d17f86f6852e87b0bda1d49946.tar.bz2 |
Tests: style.
Diffstat (limited to '')
51 files changed, 19 insertions, 74 deletions
diff --git a/test/conftest.py b/test/conftest.py index 4d46e2fc..36061f8c 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -14,7 +14,6 @@ import time from multiprocessing import Process import pytest - from unit.check.chroot import check_chroot from unit.check.go import check_go from unit.check.isolation import check_isolation diff --git a/test/python/restart/v1.py b/test/python/restart/v1.py index 2e45b269..08f7dd64 100644 --- a/test/python/restart/v1.py +++ b/test/python/restart/v1.py @@ -1,5 +1,3 @@ -import os - def application(environ, start_response): body = "v1".encode() diff --git a/test/python/restart/v2.py b/test/python/restart/v2.py index 59e3d30f..163d0d17 100644 --- a/test/python/restart/v2.py +++ b/test/python/restart/v2.py @@ -1,5 +1,3 @@ -import os - def application(environ, start_response): body = "v2".encode() diff --git a/test/python/threading/asgi.py b/test/python/threading/asgi.py index c4169a24..fed6fcce 100644 --- a/test/python/threading/asgi.py +++ b/test/python/threading/asgi.py @@ -1,7 +1,6 @@ -import asyncio import sys -import time import threading +import time class Foo(threading.Thread): diff --git a/test/python/threading/wsgi.py b/test/python/threading/wsgi.py index adaa2a37..48a73afd 100644 --- a/test/python/threading/wsgi.py +++ b/test/python/threading/wsgi.py @@ -1,6 +1,6 @@ import sys -import time import threading +import time class Foo(threading.Thread): diff --git a/test/python/threads/asgi.py b/test/python/threads/asgi.py index ff4e52ad..0537f59b 100644 --- a/test/python/threads/asgi.py +++ b/test/python/threads/asgi.py @@ -1,6 +1,5 @@ -import asyncio -import time import threading +import time async def application(scope, receive, send): diff --git a/test/python/threads/wsgi.py b/test/python/threads/wsgi.py index cc283cfe..35db2d07 100644 --- a/test/python/threads/wsgi.py +++ b/test/python/threads/wsgi.py @@ -1,5 +1,5 @@ -import time import threading +import time def application(environ, start_response): diff --git a/test/python/upload/wsgi.py b/test/python/upload/wsgi.py index 953c5ecc..2c820d06 100644 --- a/test/python/upload/wsgi.py +++ b/test/python/upload/wsgi.py @@ -1,5 +1,5 @@ +import cgi from tempfile import TemporaryFile -import os, cgi def read(environ): diff --git a/test/test_access_log.py b/test/test_access_log.py index ba254c5e..5d242a1a 100644 --- a/test/test_access_log.py +++ b/test/test_access_log.py @@ -1,7 +1,6 @@ import time import pytest - from unit.applications.lang.python import TestApplicationPython from unit.option import option diff --git a/test/test_asgi_application.py b/test/test_asgi_application.py index f503fa82..4c8a2e77 100644 --- a/test/test_asgi_application.py +++ b/test/test_asgi_application.py @@ -3,7 +3,6 @@ import time from distutils.version import LooseVersion import pytest - from unit.applications.lang.python import TestApplicationPython from unit.option import option diff --git a/test/test_asgi_lifespan.py b/test/test_asgi_lifespan.py index 90866ec3..2109a746 100644 --- a/test/test_asgi_lifespan.py +++ b/test/test_asgi_lifespan.py @@ -2,7 +2,6 @@ import os from distutils.version import LooseVersion import pytest - from conftest import unit_stop from unit.applications.lang.python import TestApplicationPython from unit.option import option diff --git a/test/test_asgi_targets.py b/test/test_asgi_targets.py index a0eb1f84..b9489cd3 100644 --- a/test/test_asgi_targets.py +++ b/test/test_asgi_targets.py @@ -1,7 +1,6 @@ from distutils.version import LooseVersion import pytest - from unit.applications.lang.python import TestApplicationPython from unit.option import option diff --git a/test/test_asgi_websockets.py b/test/test_asgi_websockets.py index 7da2d9ce..bad54e22 100644 --- a/test/test_asgi_websockets.py +++ b/test/test_asgi_websockets.py @@ -3,7 +3,6 @@ import time from distutils.version import LooseVersion import pytest - from unit.applications.lang.python import TestApplicationPython from unit.applications.websockets import TestApplicationWebsocket from unit.option import option diff --git a/test/test_client_ip.py b/test/test_client_ip.py index 0084574e..8b89b418 100644 --- a/test/test_client_ip.py +++ b/test/test_client_ip.py @@ -1,5 +1,4 @@ import pytest - from unit.applications.lang.python import TestApplicationPython diff --git a/test/test_configuration.py b/test/test_configuration.py index 8655968f..4a9d9840 100644 --- a/test/test_configuration.py +++ b/test/test_configuration.py @@ -1,7 +1,6 @@ import socket import pytest - from unit.control import TestControl diff --git a/test/test_go_isolation.py b/test/test_go_isolation.py index e02ef1cf..0530dfdf 100644 --- a/test/test_go_isolation.py +++ b/test/test_go_isolation.py @@ -3,7 +3,6 @@ import os import pwd import pytest - from unit.applications.lang.go import TestApplicationGo from unit.option import option from unit.utils import getns diff --git a/test/test_go_isolation_rootfs.py b/test/test_go_isolation_rootfs.py index 1cc59c67..2bded5ec 100644 --- a/test/test_go_isolation_rootfs.py +++ b/test/test_go_isolation_rootfs.py @@ -1,7 +1,6 @@ import os import pytest - from unit.applications.lang.go import TestApplicationGo diff --git a/test/test_http_header.py b/test/test_http_header.py index fdb557cf..ca355eb7 100644 --- a/test/test_http_header.py +++ b/test/test_http_header.py @@ -1,5 +1,4 @@ import pytest - from unit.applications.lang.python import TestApplicationPython diff --git a/test/test_java_isolation_rootfs.py b/test/test_java_isolation_rootfs.py index a401e23b..91773981 100644 --- a/test/test_java_isolation_rootfs.py +++ b/test/test_java_isolation_rootfs.py @@ -2,7 +2,6 @@ import os import subprocess import pytest - from unit.applications.lang.java import TestApplicationJava from unit.option import option diff --git a/test/test_java_websockets.py b/test/test_java_websockets.py index df0f76e8..a80d3bf3 100644 --- a/test/test_java_websockets.py +++ b/test/test_java_websockets.py @@ -2,7 +2,6 @@ import struct import time import pytest - from unit.applications.lang.java import TestApplicationJava from unit.applications.websockets import TestApplicationWebsocket from unit.option import option diff --git a/test/test_node_application.py b/test/test_node_application.py index 48ed8d3d..62a09c43 100644 --- a/test/test_node_application.py +++ b/test/test_node_application.py @@ -1,7 +1,6 @@ import re import pytest - from unit.applications.lang.node import TestApplicationNode from unit.utils import waitforfiles diff --git a/test/test_node_es_modules.py b/test/test_node_es_modules.py index 5464d4a6..47b066d5 100644 --- a/test/test_node_es_modules.py +++ b/test/test_node_es_modules.py @@ -1,7 +1,6 @@ from distutils.version import LooseVersion import pytest - from unit.applications.lang.node import TestApplicationNode from unit.applications.websockets import TestApplicationWebsocket diff --git a/test/test_node_websockets.py b/test/test_node_websockets.py index 51515f4e..e4c8a05e 100644 --- a/test/test_node_websockets.py +++ b/test/test_node_websockets.py @@ -2,7 +2,6 @@ import struct import time import pytest - from unit.applications.lang.node import TestApplicationNode from unit.applications.websockets import TestApplicationWebsocket from unit.option import option diff --git a/test/test_perl_application.py b/test/test_perl_application.py index e906aaca..dfd8be6c 100644 --- a/test/test_perl_application.py +++ b/test/test_perl_application.py @@ -1,7 +1,6 @@ import re import pytest - from unit.applications.lang.perl import TestApplicationPerl diff --git a/test/test_php_application.py b/test/test_php_application.py index 66e2ef7d..bb7d978c 100644 --- a/test/test_php_application.py +++ b/test/test_php_application.py @@ -5,7 +5,6 @@ import signal import time import pytest - from unit.applications.lang.php import TestApplicationPHP from unit.option import option diff --git a/test/test_php_isolation.py b/test/test_php_isolation.py index 8db6b590..aebeefa6 100644 --- a/test/test_php_isolation.py +++ b/test/test_php_isolation.py @@ -1,5 +1,4 @@ import pytest - from unit.applications.lang.php import TestApplicationPHP from unit.option import option diff --git a/test/test_proxy.py b/test/test_proxy.py index 3d59cf24..553cb07c 100644 --- a/test/test_proxy.py +++ b/test/test_proxy.py @@ -3,7 +3,6 @@ import socket import time import pytest - from conftest import run_process from unit.applications.lang.python import TestApplicationPython from unit.option import option diff --git a/test/test_python_application.py b/test/test_python_application.py index 48c3d603..7bd43664 100644 --- a/test/test_python_application.py +++ b/test/test_python_application.py @@ -5,7 +5,6 @@ import re import time import pytest - from unit.applications.lang.python import TestApplicationPython diff --git a/test/test_python_isolation.py b/test/test_python_isolation.py index 93f85264..53d28285 100644 --- a/test/test_python_isolation.py +++ b/test/test_python_isolation.py @@ -1,5 +1,4 @@ import pytest - from unit.applications.lang.python import TestApplicationPython from unit.option import option from unit.utils import findmnt diff --git a/test/test_python_isolation_chroot.py b/test/test_python_isolation_chroot.py index 54fbad12..1554fb72 100644 --- a/test/test_python_isolation_chroot.py +++ b/test/test_python_isolation_chroot.py @@ -1,5 +1,4 @@ import pytest - from unit.applications.lang.python import TestApplicationPython diff --git a/test/test_python_procman.py b/test/test_python_procman.py index a95c5680..389d0747 100644 --- a/test/test_python_procman.py +++ b/test/test_python_procman.py @@ -4,7 +4,6 @@ import subprocess import time import pytest - from unit.applications.lang.python import TestApplicationPython from unit.option import option @@ -265,7 +264,8 @@ class TestPythonProcman(TestApplicationPython): assert len(self.pids_for_process()) == 1, 'longstarts == 1' - pid = self.get()['body'] + self.get() + pids = self.pids_for_process() assert len(pids) == 2, 'longstarts == 2' diff --git a/test/test_python_targets.py b/test/test_python_targets.py index ca736c0d..6e5488ee 100644 --- a/test/test_python_targets.py +++ b/test/test_python_targets.py @@ -1,5 +1,4 @@ import pytest - from unit.applications.lang.python import TestApplicationPython from unit.option import option diff --git a/test/test_routing.py b/test/test_routing.py index ef5622c2..7c3b56f8 100644 --- a/test/test_routing.py +++ b/test/test_routing.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- import pytest - from unit.applications.proto import TestApplicationProto from unit.option import option diff --git a/test/test_ruby_application.py b/test/test_ruby_application.py index ddd31f59..ed0200d9 100644 --- a/test/test_ruby_application.py +++ b/test/test_ruby_application.py @@ -2,7 +2,6 @@ import re import subprocess import pytest - from unit.applications.lang.ruby import TestApplicationRuby diff --git a/test/test_ruby_hooks.py b/test/test_ruby_hooks.py index af8ce337..306ffa4b 100644 --- a/test/test_ruby_hooks.py +++ b/test/test_ruby_hooks.py @@ -1,9 +1,4 @@ -import os -import time -from pathlib import Path - import pytest - from conftest import unit_stop from unit.applications.lang.ruby import TestApplicationRuby from unit.option import option diff --git a/test/test_ruby_isolation.py b/test/test_ruby_isolation.py index f414d610..940427f1 100644 --- a/test/test_ruby_isolation.py +++ b/test/test_ruby_isolation.py @@ -1,8 +1,4 @@ -import os -import shutil - import pytest - from unit.applications.lang.ruby import TestApplicationRuby from unit.option import option diff --git a/test/test_settings.py b/test/test_settings.py index 49041b62..a16e35e8 100644 --- a/test/test_settings.py +++ b/test/test_settings.py @@ -3,7 +3,6 @@ import socket import time import pytest - from unit.applications.lang.python import TestApplicationPython from unit.utils import sysctl diff --git a/test/test_static.py b/test/test_static.py index fa0a81a2..94f790da 100644 --- a/test/test_static.py +++ b/test/test_static.py @@ -2,7 +2,6 @@ import os import socket import pytest - from unit.applications.proto import TestApplicationProto from unit.option import option from unit.utils import waitforfiles diff --git a/test/test_static_chroot.py b/test/test_static_chroot.py index 4b9d745a..62288807 100644 --- a/test/test_static_chroot.py +++ b/test/test_static_chroot.py @@ -2,7 +2,6 @@ import os from pathlib import Path import pytest - from unit.applications.proto import TestApplicationProto @@ -132,7 +131,7 @@ class TestStaticChroot(TestApplicationProto): assert self.get(url=self.test_path)['status'] == 200, 'relative' - def test_static_chroot_varibales(self, temp_dir): + def test_static_chroot_variables(self, temp_dir): assert 'success' in self.update_action( temp_dir + '/assets$uri', temp_dir + '/assets/$host' ) @@ -143,21 +142,21 @@ class TestStaticChroot(TestApplicationProto): ) assert self.get_custom('/dir/file', 'dir') == 200 - def test_static_chroot_varibales_buildin_start(self, temp_dir): + def test_static_chroot_variables_buildin_start(self, temp_dir): assert 'success' in self.update_action( temp_dir + '/assets/dir/$host', '$uri/assets/dir' ) assert self.get_custom(temp_dir, 'file') == 200 - def test_static_chroot_varibales_buildin_mid(self, temp_dir): + def test_static_chroot_variables_buildin_mid(self, temp_dir): assert 'success' in self.update_action( temp_dir + '/assets$uri', temp_dir + '/$host/dir' ) assert self.get_custom('/dir/file', 'assets') == 200 - def test_static_chroot_varibales_buildin_end(self, temp_dir): + def test_static_chroot_variables_buildin_end(self, temp_dir): assert 'success' in self.update_action( temp_dir + '/assets$uri', temp_dir + '/assets/$host' ) diff --git a/test/test_static_fallback.py b/test/test_static_fallback.py index 4cfebcec..71b268c8 100644 --- a/test/test_static_fallback.py +++ b/test/test_static_fallback.py @@ -2,7 +2,6 @@ import os from pathlib import Path import pytest - from unit.applications.proto import TestApplicationProto diff --git a/test/test_static_mount.py b/test/test_static_mount.py index fb4fbe4b..e34a8a07 100644 --- a/test/test_static_mount.py +++ b/test/test_static_mount.py @@ -3,7 +3,6 @@ import subprocess from pathlib import Path import pytest - from unit.applications.proto import TestApplicationProto diff --git a/test/test_static_share.py b/test/test_static_share.py index ad97cc3e..5384866e 100644 --- a/test/test_static_share.py +++ b/test/test_static_share.py @@ -2,7 +2,6 @@ import os from pathlib import Path import pytest - from unit.applications.proto import TestApplicationProto diff --git a/test/test_static_symlink.py b/test/test_static_symlink.py index e0fd7277..24638e20 100644 --- a/test/test_static_symlink.py +++ b/test/test_static_symlink.py @@ -2,7 +2,6 @@ import os from pathlib import Path import pytest - from unit.applications.proto import TestApplicationProto diff --git a/test/test_static_types.py b/test/test_static_types.py index 41ab7368..18564a21 100644 --- a/test/test_static_types.py +++ b/test/test_static_types.py @@ -1,7 +1,6 @@ from pathlib import Path import pytest - from unit.applications.proto import TestApplicationProto diff --git a/test/test_static_variables.py b/test/test_static_variables.py index 80673b28..e7e1629c 100644 --- a/test/test_static_variables.py +++ b/test/test_static_variables.py @@ -2,7 +2,6 @@ import os from pathlib import Path import pytest - from unit.applications.proto import TestApplicationProto @@ -30,7 +29,7 @@ class TestStaticVariables(TestApplicationProto): return self.conf('"' + share + '"', 'routes/0/action/share') - def test_static_varibales(self, temp_dir): + def test_static_variables(self, temp_dir): assert self.get(url='/index.html')['status'] == 200 assert self.get(url='/d$r/file')['status'] == 200 @@ -40,7 +39,7 @@ class TestStaticVariables(TestApplicationProto): assert 'success' in self.update_share(temp_dir + '/assets${uri}') assert self.get(url='/index.html')['status'] == 200 - def test_static_varibales_array(self, temp_dir): + def test_static_variables_array(self, temp_dir): assert 'success' in self.update_share( [temp_dir + '/assets$uri', '$uri'] ) @@ -61,18 +60,18 @@ class TestStaticVariables(TestApplicationProto): assert self.get(url=temp_dir + '/assets/index.html')['status'] == 200 assert self.get(url='/dir/blah')['status'] == 201 - def test_static_varibales_buildin_start(self, temp_dir): + def test_static_variables_buildin_start(self, temp_dir): assert 'success' in self.update_share('$uri/assets/index.html') assert self.get(url=temp_dir)['status'] == 200 - def test_static_varibales_buildin_mid(self, temp_dir): + def test_static_variables_buildin_mid(self, temp_dir): assert 'success' in self.update_share(temp_dir + '$uri/index.html') assert self.get(url='/assets')['status'] == 200 - def test_static_varibales_buildin_end(self): + def test_static_variables_buildin_end(self): assert self.get(url='/index.html')['status'] == 200 - def test_static_varibales_invalid(self, temp_dir): + def test_static_variables_invalid(self, temp_dir): assert 'error' in self.update_share(temp_dir + '/assets/d$r$uri') assert 'error' in self.update_share(temp_dir + '/assets/$$uri') assert 'error' in self.update_share( diff --git a/test/test_tls.py b/test/test_tls.py index 546f0f89..a91a3760 100644 --- a/test/test_tls.py +++ b/test/test_tls.py @@ -5,7 +5,6 @@ import subprocess import time import pytest - from unit.applications.tls import TestApplicationTLS from unit.option import option @@ -677,4 +676,3 @@ basicConstraints = critical,CA:TRUE""" assert self.get_ssl()['status'] == 200, 'listener #1' assert self.get_ssl(port=7081)['status'] == 200, 'listener #2' - diff --git a/test/test_tls_conf_command.py b/test/test_tls_conf_command.py index ccae09ad..b414b5a0 100644 --- a/test/test_tls_conf_command.py +++ b/test/test_tls_conf_command.py @@ -1,7 +1,6 @@ import ssl import pytest - from unit.applications.tls import TestApplicationTLS diff --git a/test/test_tls_sni.py b/test/test_tls_sni.py index eba6140a..28ab875b 100644 --- a/test/test_tls_sni.py +++ b/test/test_tls_sni.py @@ -2,7 +2,6 @@ import ssl import subprocess import pytest - from unit.applications.tls import TestApplicationTLS from unit.option import option diff --git a/test/unit/applications/lang/ruby.py b/test/unit/applications/lang/ruby.py index 61d50558..824bfe7f 100644 --- a/test/unit/applications/lang/ruby.py +++ b/test/unit/applications/lang/ruby.py @@ -1,4 +1,3 @@ -import os import shutil from unit.applications.proto import TestApplicationProto diff --git a/test/unit/applications/proto.py b/test/unit/applications/proto.py index e30d21ff..cd8672ba 100644 --- a/test/unit/applications/proto.py +++ b/test/unit/applications/proto.py @@ -3,8 +3,8 @@ import re import time from unit.control import TestControl -from unit.option import option from unit.log import Log +from unit.option import option class TestApplicationProto(TestControl): diff --git a/test/unit/check/isolation.py b/test/unit/check/isolation.py index 43c8842f..7f98e685 100644 --- a/test/unit/check/isolation.py +++ b/test/unit/check/isolation.py @@ -3,8 +3,8 @@ import os from unit.applications.lang.go import TestApplicationGo from unit.applications.lang.java import TestApplicationJava -from unit.applications.lang.ruby import TestApplicationRuby from unit.applications.lang.node import TestApplicationNode +from unit.applications.lang.ruby import TestApplicationRuby from unit.applications.proto import TestApplicationProto from unit.http import TestHTTP from unit.option import option |