1
0
mirror of https://github.com/fedora-python/tox-current-env.git synced 2024-12-25 01:26:13 +01:00

Remove duplicate code and only delete venv if needed

There is no associated issue. I was juts reading the code and noticed those
two related things.
This commit is contained in:
Miro Hrončok 2020-01-13 00:33:21 +01:00 committed by Petr Viktorin
parent 688a41cceb
commit dc47ce3ddf

View File

@ -132,11 +132,12 @@ def tox_testenv_create(venv, action):
# Remove the rest of the virtualenv. # Remove the rest of the virtualenv.
link = venv.envconfig.get_envpython() link = venv.envconfig.get_envpython()
target = sys.executable target = sys.executable
shutil.rmtree(os.path.dirname(os.path.dirname(link)), ignore_errors=True) rm_venv(venv)
os.makedirs(os.path.dirname(link)) os.makedirs(os.path.dirname(link))
os.symlink(target, link) os.symlink(target, link)
# prevent tox from creating the venv
return True return True
else: if not is_proper_venv(venv):
rm_venv(venv) rm_venv(venv)
return None # let tox handle the rest return None # let tox handle the rest