test_atomic_write fails under Windows
alexandrul opened this issue · comments
Eduard-Cristian Stefan commented
pytest tests\main_test.py
============================= test session starts =============================
platform win32 -- Python 3.7.1, pytest-3.10.0, py-1.7.0, pluggy-0.8.0
...
================================== FAILURES ===================================
______________________________ test_atomic_write ______________________________
...
> os.rename(tmp, path)
E FileExistsError: [WinError 183] Cannot create a file when that file already exists: 'C:\\temp\\pytest-of-me\\pytest-6\\test_atomic_write0\\.adpxavtxt' -> 'C:\\temp\\pytest-of-me\\pytest-6\\test_atomic_write0\\a'
dumb_pypi\main.py:181: FileExistsError
Eduard-Cristian Stefan commented
Using os.replace
instead of os.rename
makes the test pass (at least on my PC), but I don't have a Linux env at hand to check if it's not breaking something else.
Anthony Sottile commented
os.replace
seems to be the right function, would you like to propose a PR with that change?