pungi/tests/test_config_validate_script.py
Lubomír Sedlář cbe8457377 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>
2019-05-16 09:07:18 +02:00

31 lines
842 B
Python

# -*- coding: utf-8 -*-
import os
import subprocess
import sys
HERE = os.path.abspath(os.path.dirname(__file__))
BINDIR = os.path.join(HERE, '../bin')
PUNGI_CONFIG_VALIDATE = os.path.join(BINDIR, 'pungi-config-validate')
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
from tests import helpers
class ConfigValidateScriptTest(helpers.PungiTestCase):
def test_validate_dummy_config(self):
DUMMY_CONFIG = os.path.join(HERE, 'data/dummy-pungi.conf')
p = subprocess.Popen(
[sys.executable, "-W", "ignore", PUNGI_CONFIG_VALIDATE, DUMMY_CONFIG],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
(stdout, stderr) = p.communicate()
self.assertEqual(b'', stdout)
self.assertEqual(b'', stderr)
self.assertEqual(0, p.returncode)