patroni/debian/patches/acceptance_tests_coverage_binary.patch
Michael Banck 8a65afb554 * debian/patches/coverage_binary.patch: Removed, and replaced with ...
* debian/patches/acceptance_tests_coverage_binary.patch: ... this patch,
    which is generally applicable.
2019-02-07 18:03:48 +01:00

61 lines
2.2 KiB
Diff

--- ./features/environment.py.orig 2019-02-07 15:25:33.462976044 +0100
+++ ./features/environment.py 2019-02-07 15:26:56.663869767 +0100
@@ -1,5 +1,6 @@
import abc
import datetime
+import distutils.spawn
import etcd
import kazoo.client
import kazoo.exceptions
@@ -141,7 +142,12 @@
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],
+
+ COVERAGE_BIN = distutils.spawn.find_executable('coverage')
+ if not COVERAGE_BIN:
+ COVERAGE_BIN = distutils.spawn.find_executable('python3-coverage')
+
+ return subprocess.Popen([COVERAGE_BIN, '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 +815,13 @@
def after_all(context):
context.dcs_ctl.stop()
- subprocess.call(['coverage', 'combine'])
- subprocess.call(['coverage', 'report'])
+
+ COVERAGE_BIN = distutils.spawn.find_executable('coverage')
+ if not COVERAGE_BIN:
+ COVERAGE_BIN = distutils.spawn.find_executable('python3-coverage')
+
+ subprocess.call([COVERAGE_BIN, 'combine'])
+ subprocess.call([COVERAGE_BIN, 'report'])
def before_feature(context, feature):
--- ./features/steps/patroni_api.py.orig 2019-02-07 15:25:36.855012350 +0100
+++ ./features/steps/patroni_api.py 2019-02-07 15:27:30.840238671 +0100
@@ -1,4 +1,5 @@
import base64
+import distutils.spawn
import json
import os
import parse
@@ -95,7 +96,11 @@
@step('I run {cmd}')
def do_run(context, cmd):
- cmd = ['coverage', 'run', '--source=patroni', '-p'] + shlex.split(cmd)
+ COVERAGE_BIN = distutils.spawn.find_executable('coverage')
+ if not COVERAGE_BIN:
+ COVERAGE_BIN = distutils.spawn.find_executable('python3-coverage')
+
+ cmd = [COVERAGE_BIN, 'run', '--source=patroni', '-p'] + shlex.split(cmd)
try:
# XXX: Dirty hack! We need to take name/passwd from the config!
env = os.environ.copy()