2525import typing as t
2626import zipfile
2727from copy import deepcopy
28- from datetime import datetime
2928from urllib .parse import quote
3029
3130import common_test_methods # noqa: F401
4039from idf_ci .app import import_apps_from_txt
4140from idf_ci .uploader import AppDownloader , AppUploader
4241from idf_ci_utils import IDF_PATH , idf_relpath
43- from idf_pytest .constants import DEFAULT_SDKCONFIG , ENV_MARKERS , SPECIAL_MARKERS , TARGET_MARKERS , PytestCase
42+ from idf_pytest .constants import DEFAULT_SDKCONFIG , ENV_MARKERS , SPECIAL_MARKERS , TARGET_MARKERS , PytestCase , \
43+ DEFAULT_LOGDIR
4444from idf_pytest .plugin import IDF_PYTEST_EMBEDDED_KEY , ITEM_PYTEST_CASE_KEY , IdfPytestEmbedded
4545from idf_pytest .utils import format_case_id
4646from pytest_embedded .plugin import multi_dut_argument , multi_dut_fixture
@@ -56,15 +56,10 @@ def idf_path() -> str:
5656 return os .path .dirname (__file__ )
5757
5858
59- @pytest .fixture (scope = 'session' , autouse = True )
60- def session_tempdir () -> str :
61- _tmpdir = os .path .join (
62- os .path .dirname (__file__ ),
63- 'pytest_embedded_log' ,
64- datetime .now ().strftime ('%Y-%m-%d_%H-%M-%S' ),
65- )
66- os .makedirs (_tmpdir , exist_ok = True )
67- return _tmpdir
59+ @pytest .fixture (scope = 'session' )
60+ def session_root_logdir (idf_path : str ) -> str :
61+ """Session scoped log dir for pytest-embedded"""
62+ return idf_path
6863
6964
7065@pytest .fixture
@@ -466,11 +461,12 @@ def pytest_runtest_makereport(item, call): # type: ignore
466461
467462 job_id = os .getenv ('CI_JOB_ID' , 0 )
468463 url = os .getenv ('CI_PAGES_URL' , '' ).replace ('esp-idf' , '-/esp-idf' )
469- template = f'{ url } /-/jobs/{ job_id } /artifacts/pytest_embedded_log /{{}}'
464+ template = f'{ url } /-/jobs/{ job_id } /artifacts/{ DEFAULT_LOGDIR } /{{}}'
470465 logs_files = []
471466
472467 def get_path (x : str ) -> str :
473- return x .split ('pytest_embedded_log/' , 1 )[1 ]
468+ return x .split (f'{ DEFAULT_LOGDIR } /' , 1 )[1 ]
469+
474470 if isinstance (_dut , list ):
475471 logs_files .extend ([template .format (get_path (d .logfile )) for d in _dut ])
476472 dut_artifacts_url .append ('{}:' .format (_dut [0 ].test_case_name ))
0 commit comments