Commit 53192146 authored by Alexander's avatar Alexander

test working under linux

parent 3ab523bb
......@@ -4,37 +4,31 @@ import importlib.util
import pathlib
ROOT = pathlib.Path(__file__).parent.parent.absolute()
TESTS_FOLDER_NAME = "/tests"
print("\nSearching for tests at the path: "+ str(ROOT))
count = 0
resultCodeList = []
for (dirname, dirs, files) in os.walk(ROOT):
#print("\n In dir: "+ str(dirname))
#I assume all the tests are placed in a folder named "tests"
if ("\\tests" in str(dirname)) and not("\\tests\\" in str(dirname)):
if (TESTS_FOLDER_NAME in str(dirname)) \
and not(f"{TESTS_FOLDER_NAME}/" in str(dirname)) \
and not("venv" in str(dirname)):
try:
os.chdir(os.path.normpath(dirname))
exit_val = os.system("py -m unittest discover")
exit_val = os.system("python3.7 -m unittest discover")
resultCodeList.append(exit_val) #once per folder i.e if 3 tests are in a folder and crash, there will be just one exit val
except Exception as e:
print(e)
continue
"""
for f in files:
#print("\n Get Current Directory "+ os.getcwd())
count += 1
print("\n"+ str(count) +" Executing: "+ str(os.path.normpath(dirname+"\\"+f)))
os.system("py "+ f)
"""
firstError = -1
i = 0
while i < len(resultCodeList):
if resultCodeList[i] != 0:
print("\nA test failed with code: "+ resultCodeList[i])
# print("\nA test failed with code: "+ str(resultCodeList[i]))
if (firstError < 0):
firstError = i
i += 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment