Skip to content

Commit

Permalink
Merge pull request #4890 from blueyed/dead
Browse files Browse the repository at this point in the history
pytester: remove unused anypython fixture
  • Loading branch information
nicoddemus committed Mar 6, 2019
2 parents 4668ee0 + c86d2da commit 936f725
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 42 deletions.
1 change: 1 addition & 0 deletions changelog/4890.trivial.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove internally unused ``anypython`` fixture from the pytester plugin.
42 changes: 0 additions & 42 deletions src/_pytest/pytester.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from __future__ import print_function

import codecs
import distutils.spawn
import gc
import os
import platform
Expand Down Expand Up @@ -151,47 +150,6 @@ def pytest_runtest_protocol(self, item):
}


def getexecutable(name, cache={}):
try:
return cache[name]
except KeyError:
executable = distutils.spawn.find_executable(name)
if executable:
import subprocess

popen = subprocess.Popen(
[str(executable), "--version"],
universal_newlines=True,
stderr=subprocess.PIPE,
)
out, err = popen.communicate()
if name == "jython":
if not err or "2.5" not in err:
executable = None
if "2.5.2" in err:
executable = None # http://bugs.jython.org/issue1790
elif popen.returncode != 0:
# handle pyenv's 127
executable = None
cache[name] = executable
return executable


@pytest.fixture(params=["python2.7", "python3.4", "pypy", "pypy3"])
def anypython(request):
name = request.param
executable = getexecutable(name)
if executable is None:
if sys.platform == "win32":
executable = winpymap.get(name, None)
if executable:
executable = py.path.local(executable)
if executable.check():
return executable
pytest.skip("no suitable %s found" % (name,))
return executable


# used at least by pytest-xdist plugin


Expand Down

0 comments on commit 936f725

Please sign in to comment.