diff --git a/test/lib/lua_tarantool_server.py b/test/lib/lua_tarantool_server.py deleted file mode 100644 index 7e181fdf4e1a9704cde979266479a82e5168a9a7..0000000000000000000000000000000000000000 --- a/test/lib/lua_tarantool_server.py +++ /dev/null @@ -1,26 +0,0 @@ -import os -import sys -import glob - -from server import Server -from test_suite import Test -from tarantool_server import TarantoolServer, FuncTest - -class LuaTest(FuncTest): - def execute(self, server): - for i in open(self.name, 'r').read().replace('\n\n', '\n').split(';\n'): - server.admin(i) - -class LuaTarantoolServer(TarantoolServer): - def __new__(cls, core="lua tarantool"): - return TarantoolServer.__new__(cls) - - def __init__(self, core="lua tarantool"): - TarantoolServer.__init__(self, core) - - def find_tests(self, test_suite, suite_path): - for test_name in sorted(glob.glob(os.path.join(suite_path, "*.test"))): - for test_pattern in test_suite.args.tests: - if test_name.find(test_pattern) != -1: - test_suite.tests.append(LuaTest(test_name, test_suite.args, test_suite.ini)) - diff --git a/test/lib/python_tarantool_server.py b/test/lib/python_tarantool_server.py deleted file mode 100644 index cba5333653ba5a08f2e11ca8c7e7ccdc0bf2c0d3..0000000000000000000000000000000000000000 --- a/test/lib/python_tarantool_server.py +++ /dev/null @@ -1,25 +0,0 @@ -import os -import sys -import glob - -from server import Server -from test_suite import Test -from tarantool_server import TarantoolServer, FuncTest - -class PythonTest(FuncTest): - def execute(self, server): - execfile(self.name, dict(locals(), **server.__dict__)) - -class PythonTarantoolServer(TarantoolServer): - def __new__(cls, core="python tarantool"): - return TarantoolServer.__new__(cls) - - def __init__(self, core="python tarantool"): - TarantoolServer.__init__(self, core) - - def find_tests(self, test_suite, suite_path): - for test_name in sorted(glob.glob(os.path.join(suite_path, "*.test"))): - for test_pattern in test_suite.args.tests: - if test_name.find(test_pattern) != -1: - test_suite.tests.append(PythonTest(test_name, test_suite.args, test_suite.ini)) - diff --git a/test/lib/tarantool_server.py b/test/lib/tarantool_server.py index 465091402eab98a9ec5200ba72c4632ec7625a3a..17097e484a3f7ce3244bfd1c837aa63056f3559e 100644 --- a/test/lib/tarantool_server.py +++ b/test/lib/tarantool_server.py @@ -51,6 +51,15 @@ class FuncTest(Test): def execute(self, server): execfile(self.name, dict(locals(), **server.__dict__)) +class LuaTest(FuncTest): + def execute(self, server): + for i in open(self.name, 'r').read().replace('\n\n', '\n').split(';\n'): + server.admin(i) + +class PythonTest(FuncTest): + def execute(self, server): + execfile(self.name, dict(locals(), **server.__dict__)) + class TarantoolConfigFile: """ConfigParser can't read files without sections, work it around""" def __init__(self, fp, section_name): @@ -417,3 +426,12 @@ class TarantoolServer(Server): except socket.error as e: break + def find_tests(self, test_suite, suite_path): + def patterned(test, patterns): + for i in patterns + if test.name.find(i): + return True + return False + tests = [PythonTest(k, test_suite.args, test_sutie.args.ini) for k in sorted(glob.glob(os.path.join(suite_path, "*.test.py" ))) + tests += [PythonTest(k, test_suite.args, test_sutie.args.ini) for k in sorted(glob.glob(os.path.join(suite_path, "*.test.lua"))) + test_suite.tests = filter((lambda x: patterned(x)), test_suite.tests) diff --git a/test/lib/test_suite.py b/test/lib/test_suite.py index e1f0b9d12617a3d8a84fbf3f75ff85f9dd3b2cfd..6973c56d64cfa0f2df9c411f43efa5023d8fc446 100644 --- a/test/lib/test_suite.py +++ b/test/lib/test_suite.py @@ -1,5 +1,5 @@ import os -import os.path +import re import sys import stat import glob @@ -78,17 +78,16 @@ class Test: def __init__(self, name, args, suite_ini): """Initialize test properties: path to test file, path to - temporary result file, path to the client program, test status.""" - + temporary result file, path to the client program, test status.""" self.name = name self.args = args self.suite_ini = suite_ini - self.result = name.replace(".test", ".result") - self.skip_cond = name.replace(".test", ".skipcond") + self.result = re.sub('.test*', '.result', name) + self.skip_cond = re.sub('.test*', '.skipcond', name) self.tmp_result = os.path.join(self.args.vardir, os.path.basename(self.result)) self.reject = "{0}/test/{1}".format(self.args.builddir, - name.replace(".test", ".reject")) + re.sub('.test*', '.skipcond', name)) self.is_executed = False self.is_executed_ok = None self.is_equal_result = None