Skip to content

Commit ed4be28

Browse files
committed
Take pytest-approvaltests in use
1 parent 0acead4 commit ed4be28

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ robotstatuschecker >= 1.4
66
approvaltests >= 0.2.4
77
pytest
88
pytest-mockito
9+
pytest-approvaltests
910
requests
1011
robotframework-pabot
1112

utest/run.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python
2-
2+
import argparse
33
import os
44
import shutil
55
import sys
@@ -19,15 +19,26 @@ def remove_output_dir():
1919
os.mkdir(output_dir)
2020

2121

22-
def run_unit_tests():
22+
def run_unit_tests(reporter, reporter_args):
2323
sys.path.insert(0, SRC)
24+
py_args = ['--rootdir=%s' % CURDIR, '-p', 'no:cacheprovider', CURDIR]
25+
if reporter:
26+
py_args.insert(0, f'--approvaltests-add-reporter={reporter}')
27+
if reporter_args:
28+
py_args.insert(1, f'--approvaltests-add-reporter-args={reporter_args}')
2429
try:
25-
result = py_main(['--rootdir=%s' % CURDIR, '-p', 'no:cacheprovider', CURDIR])
30+
result = py_main(py_args)
31+
except Exception:
32+
result = 254
2633
finally:
2734
sys.path.pop(0)
2835
return result
2936

3037

3138
if __name__ == '__main__':
39+
parser = argparse.ArgumentParser(description='SeleniumLibrary Unit test runner.')
40+
parser.add_argument('-R', '--approvaltests-use-reporter', default='PythonNative', dest='reporter')
41+
parser.add_argument('-A', '--approvaltests-add-reporter-args', default=None, dest='reporter_args')
42+
args = parser.parse_args()
3243
remove_output_dir()
33-
sys.exit(run_unit_tests())
44+
sys.exit(run_unit_tests(args.reporter, args.reporter_args))

0 commit comments

Comments
 (0)