forked from robotframework/SeleniumLibrary
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
executable file
·32 lines (23 loc) · 762 Bytes
/
run.py
File metadata and controls
executable file
·32 lines (23 loc) · 762 Bytes
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
#!/usr/bin/env python
import os
import shutil
import sys
from os.path import abspath, dirname, join
from unittest import defaultTestLoader, TextTestRunner
CURDIR = dirname(abspath(__file__))
def remove_output_dir():
output_dir = os.path.join(CURDIR, 'output_dir')
if os.path.exists(output_dir):
shutil.rmtree(output_dir)
os.mkdir(output_dir)
def run_unit_tests():
sys.path.insert(0, join(CURDIR, os.pardir, 'src'))
try:
suite = defaultTestLoader.discover(join(CURDIR, 'test'), 'test_*.py')
result = TextTestRunner().run(suite)
finally:
sys.path.pop(0)
return min(len(result.failures) + len(result.errors), 255)
if __name__ == '__main__':
remove_output_dir()
sys.exit(run_unit_tests())