chriskuehl / dumb-pypi

PyPI generator, backed entirely by static files

Home Page:https://chriskuehl.github.io/dumb-pypi/test-repo/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

test_atomic_write fails under Windows

alexandrul opened this issue · comments

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

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.

os.replace seems to be the right function, would you like to propose a PR with that change?