From 5ee8f8cb59a529028bc9bae8833a1e89c11c1d58 Mon Sep 17 00:00:00 2001 From: Floris Bruynooghe Date: Sat, 20 Jul 2019 23:23:00 +0200 Subject: [PATCH] Several fixes to the intergration tests - Pass extra_link_args when using an installed libdeltachat - Allow setting the liveconfig by envvar - Show lifeconfig path in the pytest summary line - Pass required envvars through tox - Fix broken liveconfig passing in run-integration-test.sh --- python/src/deltachat/_build.py | 5 +++-- python/tests/conftest.py | 22 +++++++++++++++++----- python/tox.ini | 2 ++ run-integration-tests.sh | 7 +++---- 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/python/src/deltachat/_build.py b/python/src/deltachat/_build.py index 651d8edde..fd0641cd8 100644 --- a/python/src/deltachat/_build.py +++ b/python/src/deltachat/_build.py @@ -30,6 +30,7 @@ def ffibuilder(): libs = ['deltachat'] objs = [] incs = [] + extra_link_args = [] builder = cffi.FFI() builder.set_source( 'deltachat.capi', @@ -69,8 +70,8 @@ def ffibuilder(): distutils.sysconfig.customize_compiler(cc) tmpdir = tempfile.mkdtemp() try: - src_name = os.path.join(tmpdir, "prep.h") - dst_name = os.path.join(tmpdir, "prep2.c") + src_name = os.path.join(tmpdir, "include.h") + dst_name = os.path.join(tmpdir, "expanded.h") with open(src_name, "w") as src_fp: src_fp.write('#include ') cc.preprocess(source=src_name, diff --git a/python/tests/conftest.py b/python/tests/conftest.py index 64668d938..cf60d57dc 100644 --- a/python/tests/conftest.py +++ b/python/tests/conftest.py @@ -16,6 +16,14 @@ def pytest_addoption(parser): ) +def pytest_configure(config): + cfg = config.getoption('--liveconfig') + if not cfg: + cfg = os.getenv('DCC_PY_LIVECONFIG') + if cfg: + config.option.liveconfig = cfg + + def pytest_report_header(config, startdir): t = tempfile.mktemp() try: @@ -24,10 +32,14 @@ def pytest_report_header(config, startdir): del ac finally: os.remove(t) - return "Deltachat core={} sqlite={}".format( - info['deltachat_core_version'], - info['sqlite_version'], - ) + summary = ['Deltachat core={} sqlite={}'.format( + info['deltachat_core_version'], + info['sqlite_version'], + )] + cfg = config.getoption('--liveconfig') + if cfg: + summary.append('Liveconfig: {}'.format(os.path.abspath(cfg))) + return summary @pytest.fixture(scope="session") @@ -64,7 +76,7 @@ def acfactory(pytestconfig, tmpdir, request): def configlist(self): configlist = [] for line in open(fn): - if line.strip(): + if line.strip() and not line.strip().startswith('#'): d = {} for part in line.split(): name, value = part.split("=") diff --git a/python/tox.ini b/python/tox.ini index ccac3dee6..ba2a3b029 100644 --- a/python/tox.ini +++ b/python/tox.ini @@ -13,6 +13,8 @@ commands = passenv = TRAVIS DCC_RS_DEV + DCC_RS_TARGET + DCC_PY_LIVECONFIG deps = pytest pytest-faulthandler diff --git a/run-integration-tests.sh b/run-integration-tests.sh index 579a7b662..8633bdd77 100755 --- a/run-integration-tests.sh +++ b/run-integration-tests.sh @@ -23,11 +23,10 @@ if [ $? != 0 ]; then fi pushd python -toxargs="$@" -if [ -e liveconfig ]; then - toxargs="--liveconfig liveconfig $@" +if [ -e "./liveconfig" ]; then + export DCC_PY_LIVECONFIG=liveconfig fi -tox $toxargs +tox "$@" ret=$? popd exit $ret