summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2021-04-19 12:40:35 -0400
committerMike Frysinger <vapier@google.com>2021-06-03 15:27:51 +0000
commit816d82c010e02d3d8deb74f64628e8aab5e1d6b1 (patch)
treee1bd68edf83509f4fe661beae9e05e4ecda9aa9c
parent2b37fa3f26e6667caf17e42237f16b5bfb58fdfd (diff)
downloadgit-repo-816d82c010e02d3d8deb74f64628e8aab5e1d6b1.tar.gz
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>
-rwxr-xr-xrun_tests4
1 files changed, 4 insertions, 0 deletions
diff --git a/run_tests b/run_tests
index 6c6f8594..573dd446 100755
--- a/run_tests
+++ b/run_tests
@@ -24,6 +24,10 @@ import sys
24 24
25def find_pytest(): 25def find_pytest():
26 """Try to locate a good version of pytest.""" 26 """Try to locate a good version of pytest."""
27 # If we're in a virtualenv, assume that it's provided the right pytest.
28 if 'VIRTUAL_ENV' in os.environ:
29 return 'pytest'
30
27 # Use the Python 3 version if available. 31 # Use the Python 3 version if available.
28 ret = shutil.which('pytest-3') 32 ret = shutil.which('pytest-3')
29 if ret: 33 if ret: