fixing path.unlink for py37

This commit is contained in:
Gergő Jedlicska
2022-09-27 15:13:29 +02:00
parent 8812985c67
commit 625bd5cd84
+9 -1
View File
@@ -88,7 +88,15 @@ def test_get_transport_with_token():
@pytest.fixture
def user_path() -> Path:
path = accounts_path().joinpath("test_acc.json")
path.unlink(missing_ok=True)
# hey, py37 doesn't support the missing_ok argument
try:
path.unlink()
except:
pass
try:
path.unlink(missing_ok=True)
except:
pass
path.parent.absolute().mkdir(exist_ok=True)
yield path
path.unlink()