-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
31 lines (25 loc) · 831 Bytes
/
test.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
class Logger:
def __init__(self):
self.output = ""
def write(self, what):
self.output += str(what) + '\n'
def print(self):
print(self.output)
def runTestsFor(dictinfo):
di = dictinfo.copy()
for name in di:
if name.startswith("test_") and callable(di[name]):
logger = Logger();
print(f"Running {name}...")
try:
success = di[name](logger)
if not success:
print(f"\033[91m{name} FAILED\033[0m")
print(name + " log:")
logger.print()
except Exception as e:
print(f"\033[91m{name} FAILED ({e})\033[0m")
print(name + " log:")
logger.print()
import inquarting
runTestsFor(inquarting.__dict__)