remove tracing stuff, use --trace instead

This commit is contained in:
Daniel 2023-11-24 17:51:29 +01:00
parent ad95ed649f
commit f4cb16a162

View file

@ -84,38 +84,3 @@ def pytest_runtest_makereport(item, call):
filepath = item.funcargs["RESULTS"] / filename filepath = item.funcargs["RESULTS"] / filename
with open(filepath, "a") as f: with open(filepath, "a") as f:
f.write(rep.longreprtext + "\n") f.write(rep.longreprtext + "\n")
# trace chrome on failed test
# inspired from https://docs.pytest.org/en/6.2.x/example/simple.html#request-example
"""
@pytest.hookimpl(tryfirst=True, hookwrapper=True)
def pytest_runtest_makereport(item, call):
outcome = yield
rep = outcome.get_result()
# set a report attribute for each phase of a call, which can
# be "setup", "call", "teardown"
setattr(item, "rep_" + rep.when, rep)
@pytest.fixture
def setup(request, context: BrowserContext):
# before test
context.tracing.start(screenshots=True, snapshots=True, sources=True)
context.set_default_timeout(TIMEOUT)
# test execution
yield context
# after test
if request.node.rep_setup.failed:
# test setup failed
pass
else:
if request.node.rep_call.failed:
# test execution failed
filename = "trace-" + request.node.originalname + ".zip"
context.tracing.stop(path=filename)
"""