Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ def pytest_addoption(parser: pytest.Parser) -> None: # noqa: D103
"CRITICAL, default - INFO. An integer in [0, 50] may be also provided."
),
)
logging_group.addoption(
"--log-to",
action="store",
default=None,
dest="eest_log_dir",
help="Directory to write log files. Defaults to ./logs if not specified.",
)


@functools.cache
Expand Down Expand Up @@ -108,9 +115,10 @@ def pytest_configure(config: pytest.Config) -> None:

worker_id = os.getenv("PYTEST_XDIST_WORKER", "main")
log_filename = f"{log_stem}-{worker_id}.log"
log_path = Path("logs")
log_path.mkdir(exist_ok=True)
log_file_path = log_path / log_filename
log_dir = getattr(config.option, "eest_log_dir", None)
base_logs_dir = Path("logs") if log_dir is None else Path(log_dir)
base_logs_dir.mkdir(parents=True, exist_ok=True)
log_file_path = base_logs_dir / log_filename

# Store the log file path in the pytest config
config.option.eest_log_file_path = log_file_path
Expand Down
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ commands =
-m "not slow and not zkevm and not benchmark" \
-n auto --maxprocesses 10 --dist=loadgroup \
--basetemp="{temp_dir}/pytest" \
--log-to "{toxworkdir}/logs" \
--clean \
--until Osaka \
tests
Expand All @@ -86,6 +87,7 @@ commands =
-m "not slow and not zkevm and not benchmark" \
-n auto --maxprocesses 7 --dist=loadgroup \
--basetemp="{temp_dir}/pytest" \
--log-to "{toxworkdir}/logs" \
--clean \
--until Osaka \
tests
Expand Down
Loading