Avoid using the environment variables for feature detection and use the
feature-test utility instead.
Remove the obsolete environment variables from conf.sh, since they're no
longer used anywhere.
(cherry picked from commit
9730ac4c5691c36d58c06deec1762a4831b268c5)
#
# Determine if we support various optional features.
#
-LIBXML2_LIBS="@LIBXML2_LIBS@"
-HAVEXMLSTATS=${LIBXML2_LIBS:+1}
-JSON_C_LIBS="@JSON_C_LIBS@"
-HAVEJSONSTATS=${JSON_C_LIBS:+1}
-MAXMINDDB_LIBS="@MAXMINDDB_LIBS@"
-HAVEGEOIP2=${MAXMINDDB_LIBS:+1}
-ZLIB_LIBS="@ZLIB_LIBS@"
-HAVEZLIB=${ZLIB_LIBS:+1}
-NZD=@NZD_TOOLS@
CRYPTO=@CRYPTO@
-
-export HAVEXMLSTATS HAVEJSONSTATS
#
# Determine if we support various optional features.
#
-HAVEXMLSTATS=@XMLSTATS@
-HAVEJSONSTATS=@JSONSTATS@
-HAVEZLIB=@ZLIB@
-NZD=@NZD_TOOLS@
CRYPTO=@CRYPTO@
# The rest is shared between Windows and Unices
SYSTEMTESTTOP=..
. $SYSTEMTESTTOP/conf.sh
-if [ -z "$NZD" ]; then
+if ! $FEATURETEST --with-lmdb; then
echo_i "This test requires LMDB support (--with-lmdb)"
exit 255
fi
# information regarding copyright ownership.
import os
+import subprocess
import pytest
long_test = pytest.mark.skipif(
not os.environ.get("CI_ENABLE_ALL_TESTS"), reason="CI_ENABLE_ALL_TESTS not set"
)
+
+
+def feature_test(feature):
+ feature_test_bin = os.environ["FEATURETEST"]
+ try:
+ subprocess.run([feature_test_bin, feature], check=True)
+ except subprocess.CalledProcessError as exc:
+ if exc.returncode != 1:
+ raise
+ return False
+ return True
+
+
+have_libxml2 = pytest.mark.skipif(
+ feature_test("--have-libxml2"), reason="libxml2 support disabled in the build"
+)
+
+have_json_c = pytest.mark.skipif(
+ feature_test("--have-json-c"), reason="json-c support disabled in the build"
+)
from datetime import datetime
-import os
-
import pytest
import generic
+import pytest_custom_markers
-pytestmark = pytest.mark.skipif(
- not os.environ.get("HAVEJSONSTATS"), reason="json-c support disabled in the build"
-)
+pytestmark = pytest_custom_markers.have_json_c
requests = pytest.importorskip("requests")
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
-import xml.etree.ElementTree as ET
from datetime import datetime
-
-import os
+import xml.etree.ElementTree as ET
import pytest
import generic
+import pytest_custom_markers
-pytestmark = pytest.mark.skipif(
- not os.environ.get("HAVEXMLSTATS"), reason="libxml2 support disabled in the build"
-)
+pytestmark = pytest_custom_markers.have_libxml2
requests = pytest.importorskip("requests")