mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-03 03:31:41 +03:00
feat(test_build_system): allow buildv2 specific tests
Currently, cmakev2 is being tested only in backward-compatible mode by
using the existing cmakev1 tests with the cmakev2 test application. We
also need to add tests specific to cmakev2, and it is convenient to
reuse the existing build system testing framework. Let's add a `buildv2`
subdirectory to the existing `tools/test_build_system` directory and use
the `pytest_collection_modifyitems` hook to ignore tests in this
directory unless the `--buildv2` option is used.
Without the `--buildv2` option, only the existing cmakev1 tests are
executed and tests in `buildv2` directory are skipped. With the
`--buildv2` option, the existing cmakev1 tests run with the cmakev2
testing application for backward compatibility testing, and all cmakev2
tests within the `buildv2` subdirectory are also executed.
Note: we cannot use the `pytest_ignore_collect` hook, because the
`--buildv2` option is not known to the pytest, so the
`config.getoption('--buildv2', False)` returns always False. We would
likely need to add the `--buildv2` option in the conftest.py in the
esp-idf root directory.
Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
fix: lsadjf las jflasjfl aslfsald asl fsadlf sladsal jfsadfas
Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
This commit is contained in:
@@ -241,13 +241,18 @@ def idf_py(default_idf_env: EnvDict) -> IdfPyFunc:
|
||||
|
||||
|
||||
def pytest_collection_modifyitems(session: Session, config: Config, items: list[Item]) -> None:
|
||||
if not config.getoption('--buildv2', False):
|
||||
return
|
||||
buildv2_dir = Path(__file__).parent / 'buildv2'
|
||||
is_buildv2 = config.getoption('--buildv2', False)
|
||||
|
||||
for item in items:
|
||||
marker = item.get_closest_marker('buildv2_skip')
|
||||
if marker:
|
||||
reason = marker.args[0] if marker.args else 'Skipped as this test is specific to build system v1.'
|
||||
item.add_marker(pytest.mark.skip(reason=reason))
|
||||
if is_buildv2:
|
||||
marker = item.get_closest_marker('buildv2_skip')
|
||||
if marker:
|
||||
reason = marker.args[0] if marker.args else 'Skipped as this test is specific to build system v1.'
|
||||
item.add_marker(pytest.mark.skip(reason=reason))
|
||||
else:
|
||||
if buildv2_dir in item.path.parents or item.path == buildv2_dir:
|
||||
item.add_marker(pytest.mark.skip(reason='Skipped as build system v2 tests are disabled.'))
|
||||
|
||||
|
||||
def pytest_report_header(config: Config) -> str:
|
||||
|
||||
Reference in New Issue
Block a user