]> git.ipfire.org Git - thirdparty/bind9.git/commit
Fix skipping tests requiring the requests module
authorMichał Kępień <michal@isc.org>
Mon, 14 Mar 2022 07:59:32 +0000 (08:59 +0100)
committerMichał Kępień <michal@isc.org>
Mon, 14 Mar 2022 07:59:32 +0000 (08:59 +0100)
commit704ad2907ff84e84de2f0cfab33ff6ea3d2ea8e4
treeec0ee92dc3f55f26a9995fbfd7f408a9a21287ca
parent286b57c7f165c441170bc3aa6f7faa097161b7ee
Fix skipping tests requiring the requests module

The intended purpose of the @pytest.mark.requests decorator was to cause
Python-based parts of the "statschannel" system test to be skipped if
the requests Python module is not available.  However, both
tests-json.py and tests-xml.py contain a global "import requests"
statement which triggers ImportError exceptions during test
initialization if the requests module is not available.  In other words,
the @pytest.mark.requests decorator serves no useful purpose.

Since all tests in both tests-json.py and tests-xml.py depend on the
requests Python module, employ pytest.importorskip() to ensure the
Python-based parts of the "statschannel" system test are skipped when
the requests module is not available.  Remove all occurrences of the
@pytest.mark.requests decorator (and all associated code) to prevent
confusion.
bin/tests/system/statschannel/conftest.py
bin/tests/system/statschannel/tests-json.py
bin/tests/system/statschannel/tests-xml.py