mirror of
https://github.com/espressif/esp-idf
synced 2025-03-09 09:09:10 -04:00
ci: add temp_skip_ci
marker to simplify markers
example: `@pytest.mark.temp_skip_ci(targets=['esp32'])`
This commit is contained in:
parent
a61861f6b6
commit
056601127b
32
conftest.py
32
conftest.py
@ -126,7 +126,7 @@ def log_minimum_free_heap_size(dut: IdfDut, config: str) -> Callable[..., None]:
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def case_tester(dut: IdfDut, **kwargs): # type: ignore
|
||||
def case_tester(dut: IdfDut, **kwargs): # type: ignore
|
||||
yield CaseTester(dut, **kwargs)
|
||||
|
||||
|
||||
@ -326,15 +326,39 @@ class IdfPytestEmbedded:
|
||||
|
||||
# add markers for special markers
|
||||
for item in items:
|
||||
skip_ci_marker = item.get_closest_marker('temp_skip_ci')
|
||||
skip_ci_targets: List[str] = []
|
||||
if skip_ci_marker:
|
||||
# `temp_skip_ci` should always use keyword arguments `targets` and `reason`
|
||||
if not skip_ci_marker.kwargs.get('targets') or not skip_ci_marker.kwargs.get('reason'):
|
||||
raise ValueError(
|
||||
f'`temp_skip_ci` should always use keyword arguments `targets` and `reason`. '
|
||||
f'For example: '
|
||||
f'`@pytest.mark.temp_skip_ci(targets=["esp32"], reason="IDF-xxxx, will fix it ASAP")`'
|
||||
)
|
||||
|
||||
skip_ci_targets = skip_ci_marker.kwargs['targets']
|
||||
|
||||
if 'supported_targets' in item.keywords:
|
||||
for _target in SUPPORTED_TARGETS:
|
||||
item.add_marker(_target)
|
||||
if _target not in skip_ci_targets:
|
||||
item.add_marker(_target)
|
||||
if 'preview_targets' in item.keywords:
|
||||
for _target in PREVIEW_TARGETS:
|
||||
item.add_marker(_target)
|
||||
if _target not in skip_ci_targets:
|
||||
item.add_marker(_target)
|
||||
if 'all_targets' in item.keywords:
|
||||
for _target in [*SUPPORTED_TARGETS, *PREVIEW_TARGETS]:
|
||||
item.add_marker(_target)
|
||||
if _target not in skip_ci_targets:
|
||||
item.add_marker(_target)
|
||||
|
||||
# `temp_skip_ci(targets=...)` can't work with specified single target
|
||||
for skip_ci_target in skip_ci_targets:
|
||||
if skip_ci_target in item.keywords:
|
||||
raise ValueError(
|
||||
'`skip_ci_targets` can only work with '
|
||||
'`supported_targets`, `preview_targets`, `all_targets` markers'
|
||||
)
|
||||
|
||||
# add 'xtal_40mhz' tag as a default tag for esp32c2 target
|
||||
for item in items:
|
||||
|
@ -30,6 +30,7 @@ markers =
|
||||
supported_targets: support all supported targets ('esp32', 'esp32s2', 'esp32c3', 'esp32s3', 'esp32c2')
|
||||
preview_targets: support all preview targets ('linux', 'esp32h4', 'esp32c6')
|
||||
all_targets: support all targets, including supported ones and preview ones
|
||||
temp_skip_ci: temp skip ci for specified targets, can only work with `supported_targets`, `preview_targets`, `all_targets`
|
||||
|
||||
# env markers
|
||||
generic: tests should be run on generic runners
|
||||
|
Loading…
x
Reference in New Issue
Block a user