From 19d0b2af56633886f9272732b14195cd4ee322f8 Mon Sep 17 00:00:00 2001 From: Saugat Pachhai Date: Sat, 3 Apr 2021 13:07:07 +0545 Subject: [PATCH] use sys.executable instead of hardcoded python (#5763) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Saugat Pachhai (सौगात) --- tests/__main__.py | 4 ++-- tests/unit/test_imports.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/__main__.py b/tests/__main__.py index c36e707d9..f3dbe0337 100644 --- a/tests/__main__.py +++ b/tests/__main__.py @@ -14,7 +14,7 @@ os.putenv( ) os.putenv("DVC_HOME", REPO_ROOT) +opts = "-v -n=auto --dist loadscope --cov=dvc --durations=0" params = " ".join(sys.argv[1:]) - -cmd = f"pytest -v -n=auto --dist loadscope --cov=dvc --durations=0 {params}" +cmd = f"{sys.executable} -m pytest {opts} {params}" check_call(cmd, shell=True) diff --git a/tests/unit/test_imports.py b/tests/unit/test_imports.py index a442d2a5c..ea7d815e6 100644 --- a/tests/unit/test_imports.py +++ b/tests/unit/test_imports.py @@ -1,4 +1,5 @@ import subprocess +import sys def test_no_remote_imports(): @@ -15,7 +16,7 @@ def test_no_remote_imports(): code = "import dvc.main, sys; print(' '.join(sys.modules))" res = subprocess.run( - ["python", "-c", code], stdout=subprocess.PIPE, check=True + [sys.executable, "-c", code], stdout=subprocess.PIPE, check=True ) modules = res.stdout.decode().split() assert not set(modules) & remote_modules