diff --git a/.gitlab/ci/target-test.yml b/.gitlab/ci/target-test.yml index 691e02bda3..20653cd632 100644 --- a/.gitlab/ci/target-test.yml +++ b/.gitlab/ci/target-test.yml @@ -8,7 +8,7 @@ when: always paths: - XUNIT_RESULT.xml - - /tmp/pytest-embedded/ + - pytest_embedded_log/ reports: junit: XUNIT_RESULT.xml expire_in: 1 week diff --git a/conftest.py b/conftest.py index 76c536ce2e..a51197fc83 100644 --- a/conftest.py +++ b/conftest.py @@ -12,11 +12,11 @@ # # This is an experimental feature, and if you found any bug or have any question, please report to # https://github.com/espressif/pytest-embedded/issues - import logging import os import sys import xml.etree.ElementTree as ET +from datetime import datetime from fnmatch import fnmatch from typing import Callable, List, Optional, Tuple @@ -61,6 +61,19 @@ def item_marker_names(item: Item) -> List[str]: ############ # Fixtures # ############ +_TEST_SESSION_TMPDIR = os.path.join( + os.path.dirname(__file__), + 'pytest_embedded_log', + datetime.now().strftime('%Y-%m-%d_%H-%M-%S'), +) +os.makedirs(_TEST_SESSION_TMPDIR, exist_ok=True) + + +@pytest.fixture(scope='session', autouse=True) +def session_tempdir() -> str: + return _TEST_SESSION_TMPDIR + + @pytest.fixture @parse_configuration def config(request: FixtureRequest) -> str: @@ -79,9 +92,7 @@ def test_case_name(request: FixtureRequest, target: str, config: str) -> str: @pytest.fixture @apply_count -def build_dir( - app_path: str, target: Optional[str], config: Optional[str] -) -> str: +def build_dir(app_path: str, target: Optional[str], config: Optional[str]) -> str: """ Check local build dir with the following priority: @@ -245,7 +256,9 @@ class IdfPytestEmbedded: for _target in [*SUPPORTED_TARGETS, *PREVIEW_TARGETS]: item.add_marker(_target) # FIXME: temporarily modify the s3 runner tag "generic" to "s3_generic" due to the deep sleep bug - if 'generic' in item_marker_names(item) and 'esp32s3' in item_marker_names(item): + if 'generic' in item_marker_names(item) and 'esp32s3' in item_marker_names( + item + ): item.add_marker('generic_s3_fixme') # filter all the test cases with "--target"