mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
run_tests: fix pytest selection inside tox venv
Finding the "right" pytest is challenging. In Debian, `pytest` is Python 2 while `pytest-3` is the Python 3 version ... but only when outside of a virtualenv. Inside of a virtualenv (e.g. the ones that tox creates), we always want `pytest`. Change-Id: Ic1fe84c10f06227bceeb9baad6a3c4598bbe9860 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/303802 Reviewed-by: Peter Kjellerstedt <peter.kjellerstedt@gmail.com> Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
parent
2b37fa3f26
commit
816d82c010
@ -24,6 +24,10 @@ import sys
|
|||||||
|
|
||||||
def find_pytest():
|
def find_pytest():
|
||||||
"""Try to locate a good version of pytest."""
|
"""Try to locate a good version of pytest."""
|
||||||
|
# If we're in a virtualenv, assume that it's provided the right pytest.
|
||||||
|
if 'VIRTUAL_ENV' in os.environ:
|
||||||
|
return 'pytest'
|
||||||
|
|
||||||
# Use the Python 3 version if available.
|
# Use the Python 3 version if available.
|
||||||
ret = shutil.which('pytest-3')
|
ret = shutil.which('pytest-3')
|
||||||
if ret:
|
if ret:
|
||||||
|
Loading…
Reference in New Issue
Block a user