Skip to content

Commit 4e850f1

Browse files
committed
ci: move log dir from pytest_embedded_log to pytest-embedded
1 parent b8ed93e commit 4e850f1

File tree

8 files changed

+20
-14
lines changed

8 files changed

+20
-14
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ dependencies.lock
9696
managed_components
9797

9898
# pytest log
99+
pytest-embedded/
100+
# legacy one
99101
pytest_embedded_log/
100102
list_job*.txt
101103
size_info*.txt

.gitlab/ci/host-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ test_pytest_qemu:
296296
artifacts:
297297
paths:
298298
- XUNIT_RESULT.xml
299-
- pytest_embedded_log/
299+
- pytest-embedded/
300300
reports:
301301
junit: XUNIT_RESULT.xml
302302
allow_failure: true # IDFCI-1752
@@ -330,7 +330,7 @@ test_pytest_linux:
330330
artifacts:
331331
paths:
332332
- XUNIT_RESULT.xml
333-
- pytest_embedded_log/
333+
- pytest-embedded/
334334
- "**/build*/build_log.txt"
335335
reports:
336336
junit: XUNIT_RESULT.xml

conftest.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
from idf_ci.app import import_apps_from_txt
4040
from idf_ci.uploader import AppDownloader, AppUploader
4141
from idf_ci_utils import IDF_PATH, idf_relpath
42-
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
4344
from idf_pytest.plugin import IDF_PYTEST_EMBEDDED_KEY, ITEM_PYTEST_CASE_KEY, IdfPytestEmbedded
4445
from idf_pytest.utils import format_case_id
4546
from pytest_embedded.plugin import multi_dut_argument, multi_dut_fixture
@@ -460,11 +461,12 @@ def pytest_runtest_makereport(item, call): # type: ignore
460461

461462
job_id = os.getenv('CI_JOB_ID', 0)
462463
url = os.getenv('CI_PAGES_URL', '').replace('esp-idf', '-/esp-idf')
463-
template = f'{url}/-/jobs/{job_id}/artifacts/pytest_embedded_log/{{}}'
464+
template = f'{url}/-/jobs/{job_id}/artifacts/{DEFAULT_LOGDIR}/{{}}'
464465
logs_files = []
465466

466467
def get_path(x: str) -> str:
467-
return x.split('pytest_embedded_log/', 1)[1]
468+
return x.split(f'{DEFAULT_LOGDIR}/', 1)[1]
469+
468470
if isinstance(_dut, list):
469471
logs_files.extend([template.format(get_path(d.logfile)) for d in _dut])
470472
dut_artifacts_url.append('{}:'.format(_dut[0].test_case_name))

pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ addopts =
1313
--logfile-extension ".txt"
1414
--check-duplicates y
1515
--ignore-glob */managed_components/*
16-
--ignore pytest_embedded_log
16+
--ignore pytest-embedded
1717

1818
# ignore DeprecationWarning
1919
filterwarnings =

tools/ci/dynamic_pipelines/templates/.dynamic_jobs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
artifacts:
6161
paths:
6262
- XUNIT_RESULT*.xml
63-
- pytest_embedded_log/
63+
- pytest-embedded/
6464
# Child pipeline reports won't be collected in the main one
6565
# https://gitlab.com/groups/gitlab-org/-/epics/8205
6666
# reports:

tools/ci/idf_ci_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from functools import cached_property
1212
from pathlib import Path
1313

14-
IDF_PATH = os.path.abspath(os.getenv('IDF_PATH', os.path.join(os.path.dirname(__file__), '..', '..')))
14+
IDF_PATH: str = os.path.abspath(os.getenv('IDF_PATH', os.path.join(os.path.dirname(__file__), '..', '..')))
1515

1616

1717
def get_submodule_dirs(full_path: bool = False) -> t.List[str]:

tools/ci/idf_pytest/constants.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
SUPPORTED_TARGETS = ['esp32', 'esp32s2', 'esp32c3', 'esp32s3', 'esp32c2', 'esp32c6', 'esp32h2', 'esp32p4']
2020
PREVIEW_TARGETS: t.List[str] = [] # this PREVIEW_TARGETS excludes 'linux' target
2121
DEFAULT_SDKCONFIG = 'default'
22+
DEFAULT_LOGDIR = 'pytest-embedded'
2223

2324
TARGET_MARKERS = {
2425
'esp32': 'support esp32 target',
@@ -200,7 +201,7 @@ def targets(self) -> t.List[str]:
200201
for _t in [app.target for app in self.apps]:
201202
if _t in self.target_markers:
202203
skip = False
203-
warnings.warn(f'`pytest.mark.[TARGET]` defined in parametrize for multi-dut test cases is deprecated. '
204+
warnings.warn(f'`pytest.mark.[TARGET]` defined in parametrize for multi-dut test cases is deprecated. ' # noqa: W604
204205
f'Please use parametrize instead for test case {self.item.nodeid}')
205206
break
206207

@@ -233,7 +234,7 @@ def _get_temp_markers_disabled_targets(marker_name: str) -> t.Set[str]:
233234
# temp markers should always use keyword arguments `targets` and `reason`
234235
if not temp_marker.kwargs.get('targets') or not temp_marker.kwargs.get('reason'):
235236
raise ValueError(
236-
f'`{marker_name}` should always use keyword arguments `targets` and `reason`. '
237+
f'`{marker_name}` should always use keyword arguments `targets` and `reason`. ' # noqa: W604
237238
f'For example: '
238239
f'`@pytest.mark.{marker_name}(targets=["esp32"], reason="IDF-xxxx, will fix it ASAP")`'
239240
)
@@ -292,7 +293,7 @@ def all_built_in_app_lists(self, app_lists: t.Optional[t.List[str]] = None) -> t
292293
bin_found[i] = 1
293294

294295
if sum(bin_found) == 0:
295-
msg = f'Skip test case {self.name} because all following binaries are not listed in the app lists: '
296+
msg = f'Skip test case {self.name} because all following binaries are not listed in the app lists: ' # noqa: E713
296297
for app in self.apps:
297298
msg += f'\n - {app.build_dir}'
298299

@@ -303,7 +304,7 @@ def all_built_in_app_lists(self, app_lists: t.Optional[t.List[str]] = None) -> t
303304
return None
304305

305306
# some found, some not, looks suspicious
306-
msg = f'Found some binaries of test case {self.name} are not listed in the app lists.'
307+
msg = f'Found some binaries of test case {self.name} are not listed in the app lists.' # noqa: E713
307308
for i, app in enumerate(self.apps):
308309
if bin_found[i] == 0:
309310
msg += f'\n - {app.build_dir}'

tools/ci/idf_pytest/tests/conftest.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
sys.path.append(tools_dir)
2020

2121
from idf_ci_utils import IDF_PATH # noqa: E402
22+
from idf_pytest.constants import DEFAULT_LOGDIR # noqa: E402
2223

2324

2425
def create_project(name: str, folder: Path) -> Path:
@@ -57,9 +58,9 @@ def create_project(name: str, folder: Path) -> Path:
5758

5859
@pytest.fixture
5960
def work_dirpath() -> t.Generator[Path, None, None]:
60-
os.makedirs(os.path.join(IDF_PATH, 'pytest_embedded_log'), exist_ok=True)
61+
os.makedirs(os.path.join(IDF_PATH, DEFAULT_LOGDIR), exist_ok=True)
6162

62-
p = Path(tempfile.mkdtemp(prefix=os.path.join(IDF_PATH, 'pytest_embedded_log') + os.sep))
63+
p = Path(tempfile.mkdtemp(prefix=os.path.join(IDF_PATH, DEFAULT_LOGDIR) + os.sep))
6364

6465
try:
6566
yield p

0 commit comments

Comments
 (0)