summaryrefslogtreecommitdiffhomepage
path: root/test/unit/applications/lang
diff options
context:
space:
mode:
authorAndrei Zeliankou <zelenkov@nginx.com>2023-06-14 18:20:09 +0100
committerAndrei Zeliankou <zelenkov@nginx.com>2023-06-14 18:20:09 +0100
commitc183bd8749a19477390f8cb77efe5f6d223f0905 (patch)
tree4e821e9cb07be9a86bf2d442acb3ea6740ba5a99 /test/unit/applications/lang
parentc6d05191a069ac150cc8eb2bece75cf79c0a465a (diff)
downloadunit-c183bd8749a19477390f8cb77efe5f6d223f0905.tar.gz
unit-c183bd8749a19477390f8cb77efe5f6d223f0905.tar.bz2
Tests: get rid of classes in test files.
Class usage came from the unittest framework and it was always redundant after migration to the pytest. This commit removes classes from files containing tests to make them more readable and understandable.
Diffstat (limited to 'test/unit/applications/lang')
-rw-r--r--test/unit/applications/lang/go.py6
-rw-r--r--test/unit/applications/lang/java.py7
-rw-r--r--test/unit/applications/lang/node.py9
-rw-r--r--test/unit/applications/lang/perl.py7
-rw-r--r--test/unit/applications/lang/php.py7
-rw-r--r--test/unit/applications/lang/python.py9
-rw-r--r--test/unit/applications/lang/ruby.py7
7 files changed, 29 insertions, 23 deletions
diff --git a/test/unit/applications/lang/go.py b/test/unit/applications/lang/go.py
index 557753a4..93e0738b 100644
--- a/test/unit/applications/lang/go.py
+++ b/test/unit/applications/lang/go.py
@@ -2,11 +2,11 @@ import os
import shutil
import subprocess
-from unit.applications.proto import TestApplicationProto
+from unit.applications.proto import ApplicationProto
from unit.option import option
-class TestApplicationGo(TestApplicationProto):
+class ApplicationGo(ApplicationProto):
@staticmethod
def prepare_env(script, name='app', static=False):
try:
@@ -88,7 +88,7 @@ replace unit.nginx.org/go => {replace_path}
executable = f"/go/{name}"
static_build = True
- TestApplicationGo.prepare_env(script, name, static=static_build)
+ ApplicationGo.prepare_env(script, name, static=static_build)
conf = {
"listeners": {"*:7080": {"pass": f"applications/{script}"}},
diff --git a/test/unit/applications/lang/java.py b/test/unit/applications/lang/java.py
index b6382cfe..f6f71b7d 100644
--- a/test/unit/applications/lang/java.py
+++ b/test/unit/applications/lang/java.py
@@ -4,12 +4,13 @@ import shutil
import subprocess
import pytest
-from unit.applications.proto import TestApplicationProto
+from unit.applications.proto import ApplicationProto
from unit.option import option
-class TestApplicationJava(TestApplicationProto):
- application_type = "java"
+class ApplicationJava(ApplicationProto):
+ def __init__(self, application_type='java'):
+ self.application_type = application_type
def prepare_env(self, script):
app_path = f'{option.temp_dir}/java'
diff --git a/test/unit/applications/lang/node.py b/test/unit/applications/lang/node.py
index 87d5a19c..4f18c780 100644
--- a/test/unit/applications/lang/node.py
+++ b/test/unit/applications/lang/node.py
@@ -1,14 +1,15 @@
import shutil
from urllib.parse import quote
-from unit.applications.proto import TestApplicationProto
+from unit.applications.proto import ApplicationProto
from unit.option import option
from unit.utils import public_dir
-class TestApplicationNode(TestApplicationProto):
- application_type = "node"
- es_modules = False
+class ApplicationNode(ApplicationProto):
+ def __init__(self, application_type='node', es_modules=False):
+ self.application_type = application_type
+ self.es_modules = es_modules
def prepare_env(self, script):
# copy application
diff --git a/test/unit/applications/lang/perl.py b/test/unit/applications/lang/perl.py
index 19852363..037e98e8 100644
--- a/test/unit/applications/lang/perl.py
+++ b/test/unit/applications/lang/perl.py
@@ -1,9 +1,10 @@
-from unit.applications.proto import TestApplicationProto
+from unit.applications.proto import ApplicationProto
from unit.option import option
-class TestApplicationPerl(TestApplicationProto):
- application_type = "perl"
+class ApplicationPerl(ApplicationProto):
+ def __init__(self, application_type='perl'):
+ self.application_type = application_type
def load(self, script, name='psgi.pl', **kwargs):
script_path = f'{option.test_dir}/perl/{script}'
diff --git a/test/unit/applications/lang/php.py b/test/unit/applications/lang/php.py
index 1b94c3ae..b9b6dbf1 100644
--- a/test/unit/applications/lang/php.py
+++ b/test/unit/applications/lang/php.py
@@ -1,12 +1,13 @@
import os
import shutil
-from unit.applications.proto import TestApplicationProto
+from unit.applications.proto import ApplicationProto
from unit.option import option
-class TestApplicationPHP(TestApplicationProto):
- application_type = "php"
+class ApplicationPHP(ApplicationProto):
+ def __init__(self, application_type='php'):
+ self.application_type = application_type
def load(self, script, index='index.php', **kwargs):
script_path = f'{option.test_dir}/php/{script}'
diff --git a/test/unit/applications/lang/python.py b/test/unit/applications/lang/python.py
index 0bb69992..4e1fd897 100644
--- a/test/unit/applications/lang/python.py
+++ b/test/unit/applications/lang/python.py
@@ -2,13 +2,14 @@ import os
import shutil
from urllib.parse import quote
-from unit.applications.proto import TestApplicationProto
+from unit.applications.proto import ApplicationProto
from unit.option import option
-class TestApplicationPython(TestApplicationProto):
- application_type = "python"
- load_module = "wsgi"
+class ApplicationPython(ApplicationProto):
+ def __init__(self, application_type='python', load_module='wsgi'):
+ self.application_type = application_type
+ self.load_module = load_module
def load(self, script, name=None, module=None, **kwargs):
if name is None:
diff --git a/test/unit/applications/lang/ruby.py b/test/unit/applications/lang/ruby.py
index e0712fc6..f6c4f6c3 100644
--- a/test/unit/applications/lang/ruby.py
+++ b/test/unit/applications/lang/ruby.py
@@ -1,12 +1,13 @@
import shutil
-from unit.applications.proto import TestApplicationProto
+from unit.applications.proto import ApplicationProto
from unit.option import option
from unit.utils import public_dir
-class TestApplicationRuby(TestApplicationProto):
- application_type = "ruby"
+class ApplicationRuby(ApplicationProto):
+ def __init__(self, application_type='ruby'):
+ self.application_type = application_type
def prepare_env(self, script):
shutil.copytree(