Fix 3.7 and Windows problems Change-Id: Iec9544a055a1a2e3e2a87b8dce8360ffa64a67c3
diff --git a/test/util/helpers.py b/test/util/helpers.py index 0ca4c2d..86402c8 100644 --- a/test/util/helpers.py +++ b/test/util/helpers.py
@@ -19,9 +19,19 @@ ] +def _unlink_path(path, missing_ok=False): + # Replicate 3.8+ functionality in 3.7 + cm = contextlib.nullcontext() + if missing_ok: + cm = contextlib.suppress(FileNotFoundError) + + with cm: + path.unlink() + + def replace_file_with_dir(pathspec): path = pathlib.Path(pathspec) - path.unlink(missing_ok=True) + _unlink_path(path, missing_ok=True) path.mkdir(exist_ok=True) return path
diff --git a/tox.ini b/tox.ini index dc0530b..8b2b0d2 100644 --- a/tox.ini +++ b/tox.ini
@@ -15,8 +15,8 @@ setenv= cov: COVERAGE={[testenv]cov_args} - TEST_TEMPLATE_BASE={toxinidir}/test/templates - TEST_MODULE_BASE={env:TEST_TEMPLATE_BASE}/modules + TEST_TEMPLATE_BASE={toxinidir}{/}test{/}templates + TEST_MODULE_BASE={env:TEST_TEMPLATE_BASE}{/}modules commands=pytest {env:COVERAGE:} {posargs}