Skip to content

Commit 72e2391

Browse files
Do not reinstall in develop mode without setup.py (tox-dev#2273)
1 parent 0985677 commit 72e2391

File tree

5 files changed

+19
-1
lines changed

5 files changed

+19
-1
lines changed

CONTRIBUTORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ Tim Laurence
115115
Tyagraj Desigar
116116
Usama Sadiq
117117
Ville Skyttä
118+
Vincent Vanlaer
118119
Vlastimil Zíma
119120
Xander Johnson
120121
anatoly techtonik

docs/changelog/2197.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed an issue where ``usedevelop`` would cause an invocation error if setup.py does not exist. -- by :user:`VincentVanlaer`

docs/config.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,9 @@ Complete list of settings that you can put into ``testenv*`` sections:
596596
Install the current package in development mode with "setup.py
597597
develop" instead of installing from the ``sdist`` package. (This
598598
uses pip's ``-e`` option, so should be avoided if you've specified a
599-
custom :conf:`install_command` that does not support ``-e``).
599+
custom :conf:`install_command` that does not support ``-e``). Note that
600+
changes to the build/install process (including changes in dependencies)
601+
are only detected when using setuptools with setup.py.
600602

601603
.. conf:: skip_install ^ true|false ^ false
602604

src/tox/venv.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,10 @@ def finish(self):
325325

326326
def _needs_reinstall(self, setupdir, action):
327327
setup_py = setupdir.join("setup.py")
328+
329+
if not setup_py.exists():
330+
return False
331+
328332
setup_cfg = setupdir.join("setup.cfg")
329333
args = [self.envconfig.envpython, str(setup_py), "--name"]
330334
env = self._get_os_environ()

tests/unit/test_venv.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ def test_create(mocksession, newconfig):
7070
assert not venv.path.check()
7171
with mocksession.newaction(venv.name, "getenv") as action:
7272
tox_testenv_create(action=action, venv=venv)
73+
venv.just_created = True
7374
pcalls = mocksession._pcalls
7475
assert len(pcalls) >= 1
7576
args = pcalls[0].args
@@ -135,6 +136,7 @@ def test_create_sitepackages(mocksession, newconfig):
135136
venv = mocksession.getvenv("site")
136137
with mocksession.newaction(venv.name, "getenv") as action:
137138
tox_testenv_create(action=action, venv=venv)
139+
venv.just_created = True
138140
pcalls = mocksession._pcalls
139141
assert len(pcalls) >= 1
140142
args = pcalls[0].args
@@ -144,6 +146,7 @@ def test_create_sitepackages(mocksession, newconfig):
144146
venv = mocksession.getvenv("nosite")
145147
with mocksession.newaction(venv.name, "getenv") as action:
146148
tox_testenv_create(action=action, venv=venv)
149+
venv.just_created = True
147150
pcalls = mocksession._pcalls
148151
assert len(pcalls) >= 1
149152
args = pcalls[0].args
@@ -165,6 +168,7 @@ def test_install_deps_wildcard(newmocksession):
165168
venv = mocksession.getvenv("py123")
166169
with mocksession.newaction(venv.name, "getenv") as action:
167170
tox_testenv_create(action=action, venv=venv)
171+
venv.just_created = True
168172
pcalls = mocksession._pcalls
169173
assert len(pcalls) == 1
170174
distshare = venv.envconfig.config.distshare
@@ -201,6 +205,7 @@ def test_install_deps_indexserver(newmocksession):
201205
venv = mocksession.getvenv("py123")
202206
with mocksession.newaction(venv.name, "getenv") as action:
203207
tox_testenv_create(action=action, venv=venv)
208+
venv.just_created = True
204209
pcalls = mocksession._pcalls
205210
assert len(pcalls) == 1
206211
pcalls[:] = []
@@ -233,6 +238,7 @@ def test_install_deps_pre(newmocksession):
233238
venv = mocksession.getvenv("python")
234239
with mocksession.newaction(venv.name, "getenv") as action:
235240
tox_testenv_create(action=action, venv=venv)
241+
venv.just_created = True
236242
pcalls = mocksession._pcalls
237243
assert len(pcalls) == 1
238244
pcalls[:] = []
@@ -294,6 +300,7 @@ def test_install_sdist_extras(newmocksession):
294300
venv = mocksession.getvenv("python")
295301
with mocksession.newaction(venv.name, "getenv") as action:
296302
tox_testenv_create(action=action, venv=venv)
303+
venv.just_created = True
297304
pcalls = mocksession._pcalls
298305
assert len(pcalls) == 1
299306
pcalls[:] = []
@@ -314,6 +321,7 @@ def test_develop_extras(newmocksession, tmpdir):
314321
venv = mocksession.getvenv("python")
315322
with mocksession.newaction(venv.name, "getenv") as action:
316323
tox_testenv_create(action=action, venv=venv)
324+
venv.just_created = True
317325
pcalls = mocksession._pcalls
318326
assert len(pcalls) == 1
319327
pcalls[:] = []
@@ -519,6 +527,7 @@ def test_install_python3(newmocksession):
519527
venv = mocksession.getvenv("py123")
520528
with mocksession.newaction(venv.name, "getenv") as action:
521529
tox_testenv_create(action=action, venv=venv)
530+
venv.just_created = True
522531
pcalls = mocksession._pcalls
523532
assert len(pcalls) == 1
524533
args = pcalls[0].args
@@ -1177,6 +1186,7 @@ def test_create_download(mocksession, newconfig, download):
11771186
venv = mocksession.getvenv("env")
11781187
with mocksession.newaction(venv.name, "getenv") as action:
11791188
tox_testenv_create(action=action, venv=venv)
1189+
venv.just_created = True
11801190
pcalls = mocksession._pcalls
11811191
assert len(pcalls) >= 1
11821192
args = pcalls[0].args

0 commit comments

Comments
 (0)