Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelog/1383.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
improve recreate check by allowing directories containing ``.tox-config1`` (the marker file created by tox) - by :user:`asottile`
4 changes: 3 additions & 1 deletion src/tox/venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ def cleanup_for_venv(venv):
# an error
if venv.path.exists():
dir_items = set(os.listdir(str(venv.path))) - {".lock", "log"}
dir_items = {p for p in dir_items if not p.startswith(".tox-")}
dir_items = {p for p in dir_items if not p.startswith(".tox-") or p == ".tox-config1"}
else:
dir_items = set()

Expand All @@ -707,6 +707,8 @@ def cleanup_for_venv(venv):
not venv.path.exists()
# does exist, but it's empty => OK
or not dir_items
# tox has marked this as an environment it has created in the past
or ".tox-config1" in dir_items
# it exists and we're on windows with Lib and Scripts => OK
or (INFO.IS_WIN and dir_items > {"Scripts", "Lib"})
# non-windows, with lib and bin => OK
Expand Down