Run coverage as python -m coverage (#968)

Depending on the platform the coverage binary might not always be available under the standard name.
This commit is contained in:
Michael Banck
2019-02-13 16:02:12 +01:00
committed by Alexander Kukushkin
parent 345e6d3131
commit 073074f83e
2 changed files with 7 additions and 4 deletions
+5 -3
View File
@@ -12,6 +12,7 @@ import shutil
import signal
import six
import subprocess
import sys
import tempfile
import threading
import time
@@ -142,7 +143,8 @@ class PatroniController(AbstractController):
if isinstance(self._context.dcs_ctl, KubernetesController):
self._context.dcs_ctl.create_pod(self._name[8:], self._scope)
os.environ['PATRONI_KUBERNETES_POD_IP'] = '10.0.0.' + self._name[-1]
return subprocess.Popen(['coverage', 'run', '--source=patroni', '-p', 'patroni.py', self._config],
return subprocess.Popen([sys.executable, '-m', 'coverage', 'run',
'--source=patroni', '-p', 'patroni.py', self._config],
stdout=self._log, stderr=subprocess.STDOUT, cwd=self._work_directory)
def stop(self, kill=False, timeout=15, postgres=False):
@@ -809,8 +811,8 @@ def before_all(context):
def after_all(context):
context.dcs_ctl.stop()
subprocess.call(['coverage', 'combine'])
subprocess.call(['coverage', 'report'])
subprocess.call([sys.executable, '-m', 'coverage', 'combine'])
subprocess.call([sys.executable, '-m', 'coverage', 'report'])
def before_feature(context, feature):