records -> results
This commit is contained in:
parent
093818bc81
commit
7c1f1ff5d4
5 changed files with 13 additions and 18 deletions
|
|
@ -37,7 +37,7 @@ def run():
|
|||
|
||||
# todo: move to Coordinator
|
||||
DIR = DirManager(output_dir=args.output_dir, session_id=session_id)
|
||||
log_file = DIR.RECORDS / "coordinator.log"
|
||||
log_file = DIR.RESULTS / "coordinator.log"
|
||||
logger.add(log_file)
|
||||
|
||||
# ---------------------------- initialize and run ---------------------------- #
|
||||
|
|
|
|||
|
|
@ -60,13 +60,13 @@ class Coordinator:
|
|||
|
||||
def combine_html(self) -> None:
|
||||
"""combines all generated pytest html reports into one"""
|
||||
in_dir_path = str(self.DIR.RECORDS / "html")
|
||||
out_file_path = str(self.DIR.RECORDS / "full-report.html")
|
||||
in_dir_path = str(self.DIR.RESULTS / "html")
|
||||
out_file_path = str(self.DIR.RESULTS / "full-report.html")
|
||||
title = "combined.html"
|
||||
merge_html_reports(in_dir_path, out_file_path, title)
|
||||
|
||||
def collect_traces(self):
|
||||
"""moves all traces into SESSION/RECORDS dir
|
||||
"""moves all traces into SESSION/RESULTS dir
|
||||
|
||||
if tests are rerun and generate another trace, the new trace will get a unique name such as
|
||||
tracename-0
|
||||
|
|
@ -82,9 +82,9 @@ class Coordinator:
|
|||
index += 1
|
||||
return get_new_path(root_dir, base_name, index=index)
|
||||
|
||||
trace_root_dir = self.DIR.RECORDS / "traces"
|
||||
trace_root_dir = self.DIR.RESULTS / "traces"
|
||||
for f in trace_root_dir.rglob("*/trace.zip"):
|
||||
new_path = get_new_path(self.DIR.RECORDS, f.parent.name)
|
||||
new_path = get_new_path(self.DIR.RESULTS, f.parent.name)
|
||||
f.parent.rename(new_path)
|
||||
rmtree(trace_root_dir)
|
||||
|
||||
|
|
|
|||
|
|
@ -49,9 +49,9 @@ def DIR(request) -> DirManager:
|
|||
|
||||
DIR.OUTPUT
|
||||
DIR.SESSION
|
||||
DIR.RECORDS
|
||||
DIR.STATES
|
||||
DIR.RESULTS"""
|
||||
DIR.RESULTS
|
||||
DIR.STATUS"""
|
||||
|
||||
output_dir = request.config.getoption("--output_dir")
|
||||
assert output_dir, "pytest argument --output_dir not set"
|
||||
|
|
|
|||
|
|
@ -11,11 +11,11 @@ class DirManager:
|
|||
The structures is as follows:
|
||||
tests dir/
|
||||
session_id-1/
|
||||
records
|
||||
results
|
||||
states
|
||||
status
|
||||
session_id-2/
|
||||
records
|
||||
results
|
||||
...
|
||||
"""
|
||||
|
||||
|
|
@ -32,7 +32,6 @@ class DirManager:
|
|||
dirs: list[Path] = [
|
||||
self.OUTPUT_DIR,
|
||||
self.SESSION,
|
||||
self.RECORDS,
|
||||
self.HTML,
|
||||
self.STATES,
|
||||
self.ENV_FILES,
|
||||
|
|
@ -50,13 +49,9 @@ class DirManager:
|
|||
def SESSION(self):
|
||||
return self.OUTPUT_DIR / self.session_id
|
||||
|
||||
@property
|
||||
def RECORDS(self):
|
||||
return self.SESSION / "records"
|
||||
|
||||
@property
|
||||
def HTML(self):
|
||||
return self.RECORDS / "html"
|
||||
return self.RESULTS / "html"
|
||||
|
||||
@property
|
||||
def STATES(self):
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ class Runner:
|
|||
# --output only works with the given context and page fixture
|
||||
# folder needs to be unique! traces will not appear, if every pytest run has same output dir
|
||||
command_arguments.append("--output")
|
||||
command_arguments.append(str(self.DIR.RECORDS / "traces" / full_test_path.stem))
|
||||
command_arguments.append(str(self.DIR.RESULTS / "traces" / full_test_path.stem))
|
||||
|
||||
# tracing
|
||||
command_arguments.append("--tracing") # "on", "off", "retain-on-failure"
|
||||
|
|
@ -173,7 +173,7 @@ class Runner:
|
|||
# command_arguments.append("--headed")
|
||||
|
||||
# html report. Will be combined into one file later.
|
||||
command_arguments.append(f"--html={self.DIR.RECORDS / 'html' / full_test_path.with_suffix('.html').name}")
|
||||
command_arguments.append(f"--html={self.DIR.RESULTS / 'html' / full_test_path.with_suffix('.html').name}")
|
||||
|
||||
return pytest.main(command_arguments)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue