tests: cleaner way to get the ui parameter

pull/971/head
matejcik 4 years ago committed by matejcik
parent 4035aad51b
commit dab41fd680

@ -90,8 +90,6 @@ def client(request):
)
test_ui = request.config.getoption("ui")
if test_ui not in ("", "record", "test"):
raise ValueError("Invalid ui option.")
run_ui_tests = not request.node.get_closest_marker("skip_ui") and test_ui
client.open()
@ -195,7 +193,7 @@ def pytest_addoption(parser):
parser.addoption(
"--ui",
action="store",
default="",
choices=["test", "record"],
help="Enable UI intergration tests: 'record' or 'test'",
)
parser.addoption(

@ -82,10 +82,8 @@ def screen_recording(client, request):
if test_ui == "record":
screen_path = screens_test_path / "recorded"
elif test_ui == "test":
screen_path = screens_test_path / "actual"
else:
raise ValueError("Invalid 'ui' option.")
screen_path = screens_test_path / "actual"
if not screens_test_path.exists():
screens_test_path.mkdir()
@ -98,10 +96,8 @@ def screen_recording(client, request):
yield
if test_ui == "record":
_process_recorded(screen_path, test_name)
elif test_ui == "test":
_process_tested(screens_test_path, test_name)
else:
raise ValueError("Invalid 'ui' option.")
_process_tested(screens_test_path, test_name)
finally:
client.debug.stop_recording()

Loading…
Cancel
Save