File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
packages/tests/src/pytest_plugins/custom_logging Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -317,9 +317,18 @@ def pytest_configure(config: pytest.Config) -> None:
317317
318318 worker_id = os .getenv ("PYTEST_XDIST_WORKER" , "main" )
319319 log_filename = f"{ log_stem } -{ worker_id } .log"
320- log_path = Path ("logs" )
321- log_path .mkdir (exist_ok = True )
322- log_file_path = log_path / log_filename
320+ basetemp_opt = getattr (config .option , "basetemp" , None )
321+ tox_work_dir = os .environ .get ("TOX_WORK_DIR" )
322+
323+ if basetemp_opt :
324+ base_logs_dir = Path (str (basetemp_opt )) / "logs"
325+ elif tox_work_dir :
326+ base_logs_dir = Path (tox_work_dir ) / "logs"
327+ else :
328+ base_logs_dir = Path ("logs" )
329+
330+ base_logs_dir .mkdir (parents = True , exist_ok = True )
331+ log_file_path = base_logs_dir / log_filename
323332
324333 # Store the log file path in the pytest config
325334 config .option .eest_log_file_path = log_file_path
You can’t perform that action at this time.
0 commit comments