diff --git a/bin/tests/system/rpzextra/conftest.py b/bin/tests/system/rpzextra/conftest.py index 8bbcf25ad7..aa2034fcb0 100644 --- a/bin/tests/system/rpzextra/conftest.py +++ b/bin/tests/system/rpzextra/conftest.py @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -import os import pytest try: @@ -34,9 +33,3 @@ def pytest_collection_modifyitems(config, items): for item in items: if "dnspython" in item.keywords: item.add_marker(skip_requests) - # Test if JSON statistics channel was enabled - no_jsonstats = pytest.mark.skip(reason="need JSON statistics to be enabled") - if os.getenv("HAVEJSONSTATS") is None: - for item in items: - if "json" in item.keywords: - item.add_marker(no_jsonstats) diff --git a/bin/tests/system/statschannel/conftest.py b/bin/tests/system/statschannel/conftest.py index 798bee7300..0a766781fa 100644 --- a/bin/tests/system/statschannel/conftest.py +++ b/bin/tests/system/statschannel/conftest.py @@ -17,9 +17,6 @@ def pytest_configure(config): config.addinivalue_line( "markers", "requests: mark tests that need requests to function" ) - config.addinivalue_line( - "markers", "json: mark tests that need json to function" - ) config.addinivalue_line( "markers", "xml: mark tests that need xml.etree to function" ) @@ -37,15 +34,6 @@ def pytest_collection_modifyitems(config, items): for item in items: if "requests" in item.keywords: item.add_marker(skip_requests) - # Test for json module - skip_json = pytest.mark.skip( - reason="need json module to run") - try: - import json # noqa: F401 - except ModuleNotFoundError: - for item in items: - if "json" in item.keywords: - item.add_marker(skip_json) # Test for xml module skip_xml = pytest.mark.skip( reason="need xml module to run") @@ -55,13 +43,6 @@ def pytest_collection_modifyitems(config, items): for item in items: if "xml" in item.keywords: item.add_marker(skip_xml) - # Test if JSON statistics channel was enabled - no_jsonstats = pytest.mark.skip( - reason="need JSON statistics to be enabled") - if os.getenv("HAVEJSONSTATS") is None: - for item in items: - if "json" in item.keywords: - item.add_marker(no_jsonstats) # Test if XML statistics channel was enabled no_xmlstats = pytest.mark.skip( reason="need XML statistics to be enabled") diff --git a/bin/tests/system/statschannel/tests-json.py b/bin/tests/system/statschannel/tests-json.py index 1f4d6d6e65..84337a7a8b 100755 --- a/bin/tests/system/statschannel/tests-json.py +++ b/bin/tests/system/statschannel/tests-json.py @@ -20,6 +20,9 @@ import requests import generic +pytestmark = pytest.mark.skipif(not os.environ.get('HAVEJSONSTATS'), + reason='json-c support disabled in the build') + # JSON helper functions def fetch_zones_json(statsip, statsport): @@ -72,39 +75,27 @@ def load_zone_json(zone): return name -@pytest.mark.json @pytest.mark.requests -@pytest.mark.skipif(os.getenv("HAVEJSONSTATS", "unset") != "1", - reason="JSON not configured") def test_zone_timers_primary_json(statsport): generic.test_zone_timers_primary(fetch_zones_json, load_timers_json, statsip="10.53.0.1", statsport=statsport, zonedir="ns1") -@pytest.mark.json @pytest.mark.requests -@pytest.mark.skipif(os.getenv("HAVEJSONSTATS", "unset") != "1", - reason="JSON not configured") def test_zone_timers_secondary_json(statsport): generic.test_zone_timers_secondary(fetch_zones_json, load_timers_json, statsip="10.53.0.3", statsport=statsport, zonedir="ns3") -@pytest.mark.json @pytest.mark.requests -@pytest.mark.skipif(os.getenv("HAVEJSONSTATS", "unset") != "1", - reason="JSON not configured") def test_zone_with_many_keys_json(statsport): generic.test_zone_with_many_keys(fetch_zones_json, load_zone_json, statsip="10.53.0.2", statsport=statsport) -@pytest.mark.json @pytest.mark.requests -@pytest.mark.skipif(os.getenv("HAVEJSONSTATS", "unset") != "1", - reason="JSON not configured") def test_traffic_json(named_port, statsport): generic_dnspython = pytest.importorskip('generic_dnspython') generic_dnspython.test_traffic(fetch_traffic_json,