mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
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:
committed by
Alexander Kukushkin
parent
345e6d3131
commit
073074f83e
@@ -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):
|
||||
|
||||
@@ -5,6 +5,7 @@ import parse
|
||||
import requests
|
||||
import shlex
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
import yaml
|
||||
|
||||
@@ -95,7 +96,7 @@ def do_request(context, request_method, url, data):
|
||||
|
||||
@step('I run {cmd}')
|
||||
def do_run(context, cmd):
|
||||
cmd = ['coverage', 'run', '--source=patroni', '-p'] + shlex.split(cmd)
|
||||
cmd = [sys.executable, '-m', 'coverage', 'run', '--source=patroni', '-p'] + shlex.split(cmd)
|
||||
try:
|
||||
# XXX: Dirty hack! We need to take name/passwd from the config!
|
||||
env = os.environ.copy()
|
||||
|
||||
Reference in New Issue
Block a user