Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve recreate check by looking for .tox-config1 #1383

Merged
merged 1 commit into from
Jul 29, 2019
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.
Jump to
Jump to file
Failed to load files.
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
asottile marked this conversation as resolved.
Show resolved Hide resolved
or (INFO.IS_WIN and dir_items > {"Scripts", "Lib"})
# non-windows, with lib and bin => OK
Expand Down