Skip to content

Commit 8ce4f91

Browse files
committed
Fix 3.7 and Windows problems
Change-Id: Iec9544a055a1a2e3e2a87b8dce8360ffa64a67c3
1 parent 8c4ce94 commit 8ce4f91

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

test/util/helpers.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,19 @@ def result_lines(result):
1919
]
2020

2121

22+
def _unlink_path(path, missing_ok=False):
23+
# Replicate 3.8+ functionality in 3.7
24+
cm = contextlib.nullcontext()
25+
if missing_ok:
26+
cm = contextlib.suppress(FileNotFoundError)
27+
28+
with cm:
29+
path.unlink()
30+
31+
2232
def replace_file_with_dir(pathspec):
2333
path = pathlib.Path(pathspec)
24-
path.unlink(missing_ok=True)
34+
_unlink_path(path, missing_ok=True)
2535
path.mkdir(exist_ok=True)
2636
return path
2737

tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ deps=pytest>=3.1.0
1515

1616
setenv=
1717
cov: COVERAGE={[testenv]cov_args}
18-
TEST_TEMPLATE_BASE={toxinidir}/test/templates
19-
TEST_MODULE_BASE={env:TEST_TEMPLATE_BASE}/modules
18+
TEST_TEMPLATE_BASE={toxinidir}{/}test{/}templates
19+
TEST_MODULE_BASE={env:TEST_TEMPLATE_BASE}{/}modules
2020

2121
commands=pytest {env:COVERAGE:} {posargs}
2222

0 commit comments

Comments
 (0)