tests: Use correct Python interpreter

Instead of guessing based on a good enough name, we can use
`sys.executable` and get path to current python.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2019-05-16 09:07:18 +02:00
parent a33cb0bf91
commit cbe8457377

View File

@ -5,8 +5,6 @@ import os
import subprocess
import sys
import six
HERE = os.path.abspath(os.path.dirname(__file__))
BINDIR = os.path.join(HERE, '../bin')
@ -21,9 +19,8 @@ class ConfigValidateScriptTest(helpers.PungiTestCase):
def test_validate_dummy_config(self):
DUMMY_CONFIG = os.path.join(HERE, 'data/dummy-pungi.conf')
interp = 'python2' if six.PY2 else 'python3'
p = subprocess.Popen(
[interp, "-W", "ignore", PUNGI_CONFIG_VALIDATE, DUMMY_CONFIG],
[sys.executable, "-W", "ignore", PUNGI_CONFIG_VALIDATE, DUMMY_CONFIG],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)