ci: always cleanup idf copy in ci

This commit is contained in:
Fu Hanxi
2024-04-16 14:11:31 +02:00
parent b5607cf43c
commit a4f691b88a
2 changed files with 11 additions and 3 deletions

View File

@@ -31,7 +31,7 @@ def pytest_runtest_makereport(item: typing.Any, call: typing.Any) -> typing.Gene
def should_clean_test_dir(request: FixtureRequest) -> bool:
# Only remove the test directory if the test has passed
return getattr(request.node, 'passed', False)
return getattr(request.node, 'passed', False) or request.config.getoption('cleanup_idf_copy', False)
def pytest_addoption(parser: pytest.Parser) -> None:
@@ -40,6 +40,10 @@ def pytest_addoption(parser: pytest.Parser) -> None:
help='Directory for temporary files. If not specified, an OS-specific '
'temporary directory will be used.'
)
parser.addoption(
'--cleanup-idf-copy', action='store_true',
help='Always clean up the IDF copy after the test. By default, the copy is cleaned up only if the test passes.'
)
@pytest.fixture(scope='session')