diff --git a/tests/run_pytest.py b/tests/run_pytest.py new file mode 100644 index 0000000000000000000000000000000000000000..a39f5c56dd1c9e0494eca31aedab907ffc1998ef --- /dev/null +++ b/tests/run_pytest.py @@ -0,0 +1,8 @@ +''' +Created on 29/01/2016 + +@author: mmpe +''' +import pytest +import os +pytest.main(os.path.dirname(__file__) + "./../") diff --git a/tests/testsuite.py b/tests/testsuite.py index 73da007fbe5b1801c3f6e8ffaf90c5e72ddc8a07..9df434c1c104a3ad63dd6c947d2de9897e42ee44 100644 --- a/tests/testsuite.py +++ b/tests/testsuite.py @@ -1,22 +1,21 @@ import glob import unittest import os -from os.path import dirname, relpath, abspath + def module_strings(): - test_file_paths = [] + test_file_paths = glob.glob('test_*.py') #test_file_strings.extend(glob.glob('../wetb/**/test_*.py')) #for root,_,_ in os.walk("../wetb/"): - for folder, _, _ in os.walk(os.path.abspath(dirname(__file__) + '../wetb/')): - test_file_paths.extend(glob.glob(folder + "/tests/test_*.py")) - return [relpath(s, abspath(dirname(__file__) + "/../")).replace(".py", "").replace(os.path.sep, ".") for s in test_file_paths] + for folder, _, _ in os.walk('../wetb'): + test_file_paths.extend(glob.glob(os.path.join(folder, "tests/test_*.py"))) + return [s[3:len(s) - 3].replace(os.path.sep, ".") for s in test_file_paths] def suite(): - modules = module_strings() - suites = [] try: - for s in modules: + suites = [] + for s in module_strings(): suites.append(unittest.defaultTestLoader.loadTestsFromName(s)) except: print ("Failed to import '%s'" % s)