Skip to content

Commit

Permalink
Improve recreate check by looking for .tox-config1 (#1383)
Browse files Browse the repository at this point in the history
  • Loading branch information
asottile committed Jul 29, 2019
1 parent 57f8cc2 commit d056fd2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
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

0 comments on commit d056fd2

Please sign in to comment.