Skip to content
Snippets Groups Projects
Commit f9ab38c8 authored by mads's avatar mads
Browse files

call testsuite from any working directory

parent 07feda9f
No related branches found
No related tags found
No related merge requests found
Pipeline #
import glob
import unittest
import os
from os.path import dirname, relpath, abspath
def module_strings():
test_file_paths = glob.glob('test_*.py')
test_file_paths = []
#test_file_strings.extend(glob.glob('../wetb/**/test_*.py'))
#for root,_,_ in os.walk("../wetb/"):
for folder, _, _ in os.walk(os.path.join(os.path.dirname(__file__), '../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]
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]
def suite():
......@@ -60,4 +60,4 @@ else:
for mstr in module_strings():
print (mstr)
__import__(mstr, {}, {}, "*")
exec("from %s import *" % mstr)
\ No newline at end of file
exec("from %s import *" % mstr)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment