diff --git a/bin/tests/system/statschannel/conftest.py b/bin/tests/system/statschannel/conftest.py index f876f5d56e..363dd7ad1b 100644 --- a/bin/tests/system/statschannel/conftest.py +++ b/bin/tests/system/statschannel/conftest.py @@ -13,26 +13,6 @@ import os import pytest -def pytest_configure(config): - config.addinivalue_line( - "markers", "requests: mark tests that need requests to function" - ) - - -def pytest_collection_modifyitems(config, items): - # pylint: disable=unused-argument,unused-import,too-many-branches - # pylint: disable=import-outside-toplevel - # Test for requests module - skip_requests = pytest.mark.skip( - reason="need requests module to run") - try: - import requests # noqa: F401 - except ModuleNotFoundError: - for item in items: - if "requests" in item.keywords: - item.add_marker(skip_requests) - - @pytest.fixture def statsport(request): # pylint: disable=unused-argument diff --git a/bin/tests/system/statschannel/tests-json.py b/bin/tests/system/statschannel/tests-json.py index 84337a7a8b..373f98d30b 100755 --- a/bin/tests/system/statschannel/tests-json.py +++ b/bin/tests/system/statschannel/tests-json.py @@ -16,12 +16,12 @@ from datetime import datetime import os import pytest -import requests import generic pytestmark = pytest.mark.skipif(not os.environ.get('HAVEJSONSTATS'), reason='json-c support disabled in the build') +requests = pytest.importorskip('requests') # JSON helper functions @@ -75,27 +75,23 @@ def load_zone_json(zone): return name -@pytest.mark.requests 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.requests 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.requests 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.requests def test_traffic_json(named_port, statsport): generic_dnspython = pytest.importorskip('generic_dnspython') generic_dnspython.test_traffic(fetch_traffic_json, diff --git a/bin/tests/system/statschannel/tests-xml.py b/bin/tests/system/statschannel/tests-xml.py index 75edc1a8c4..73b6e909f3 100755 --- a/bin/tests/system/statschannel/tests-xml.py +++ b/bin/tests/system/statschannel/tests-xml.py @@ -17,12 +17,12 @@ from datetime import datetime import os import pytest -import requests import generic pytestmark = pytest.mark.skipif(not os.environ.get('HAVEXMLSTATS'), reason='libxml2 support disabled in the build') +requests = pytest.importorskip('requests') # XML helper functions @@ -105,27 +105,23 @@ def load_zone_xml(zone): return name -@pytest.mark.requests def test_zone_timers_primary_xml(statsport): generic.test_zone_timers_primary(fetch_zones_xml, load_timers_xml, statsip="10.53.0.1", statsport=statsport, zonedir="ns1") -@pytest.mark.requests def test_zone_timers_secondary_xml(statsport): generic.test_zone_timers_secondary(fetch_zones_xml, load_timers_xml, statsip="10.53.0.3", statsport=statsport, zonedir="ns3") -@pytest.mark.requests def test_zone_with_many_keys_xml(statsport): generic.test_zone_with_many_keys(fetch_zones_xml, load_zone_xml, statsip="10.53.0.2", statsport=statsport) -@pytest.mark.requests def test_traffic_xml(named_port, statsport): generic_dnspython = pytest.importorskip('generic_dnspython') generic_dnspython.test_traffic(fetch_traffic_xml,