Skip to content

Commit 936f725

Browse files
authored
Merge pull request #4890 from blueyed/dead
pytester: remove unused anypython fixture
2 parents 4668ee0 + c86d2da commit 936f725

File tree

2 files changed

+1
-42
lines changed

2 files changed

+1
-42
lines changed

changelog/4890.trivial.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove internally unused ``anypython`` fixture from the pytester plugin.

src/_pytest/pytester.py

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from __future__ import print_function
55

66
import codecs
7-
import distutils.spawn
87
import gc
98
import os
109
import platform
@@ -151,47 +150,6 @@ def pytest_runtest_protocol(self, item):
151150
}
152151

153152

154-
def getexecutable(name, cache={}):
155-
try:
156-
return cache[name]
157-
except KeyError:
158-
executable = distutils.spawn.find_executable(name)
159-
if executable:
160-
import subprocess
161-
162-
popen = subprocess.Popen(
163-
[str(executable), "--version"],
164-
universal_newlines=True,
165-
stderr=subprocess.PIPE,
166-
)
167-
out, err = popen.communicate()
168-
if name == "jython":
169-
if not err or "2.5" not in err:
170-
executable = None
171-
if "2.5.2" in err:
172-
executable = None # http://bugs.jython.org/issue1790
173-
elif popen.returncode != 0:
174-
# handle pyenv's 127
175-
executable = None
176-
cache[name] = executable
177-
return executable
178-
179-
180-
@pytest.fixture(params=["python2.7", "python3.4", "pypy", "pypy3"])
181-
def anypython(request):
182-
name = request.param
183-
executable = getexecutable(name)
184-
if executable is None:
185-
if sys.platform == "win32":
186-
executable = winpymap.get(name, None)
187-
if executable:
188-
executable = py.path.local(executable)
189-
if executable.check():
190-
return executable
191-
pytest.skip("no suitable %s found" % (name,))
192-
return executable
193-
194-
195153
# used at least by pytest-xdist plugin
196154

197155

0 commit comments

Comments
 (0)