-
Notifications
You must be signed in to change notification settings - Fork 58
/
image_tests.py
35 lines (31 loc) · 1.01 KB
/
image_tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python3
import os
import imp
import ntpath
from inspect import getsourcefile
# change dir to where this test lives
ntpath.os.chdir(ntpath.dirname(getsourcefile(lambda:0)))
path = os.path.abspath('./image_tests/')
#Check if the viewer is working
import underworld.visualisation as vis
if not vis.lavavu:
print("Image tests skipped, Viewer disabled")
exit()
try:
import nbconvert
except ModuleNotFoundError:
print("Skipping image_test.py as nbconvert can't be found")
exit()
for d in os.listdir(path):
testd = os.path.join(path,d)
if not os.path.isdir(testd): continue
if str(d)[0] == '.': continue
modfile = os.path.join(path, str(d) + '/runtest.py')
if not os.path.isfile(modfile): continue;
os.chdir(testd)
print("Running tests in " + os.getcwd())
print("===================================================")
#print modfile
testmod = imp.load_source('runtest', modfile)
os.chdir(path)
print("===================================================")