summaryrefslogtreecommitdiff
path: root/conftest.py
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-06-14 13:16:28 +0200
committerWojtek Kosior <koszko@koszko.org>2022-06-14 13:16:28 +0200
commit2fc043b30a492d69bb00912867d6d27541419ebc (patch)
tree58b8911bb3cf84186cce2c327073ded1a165d3e0 /conftest.py
parentce480820e03122468a29db0cad1c8a97b62bf6c1 (diff)
downloadhydrilla-builder-83fcfd7c39b7f425c43c86bd2907b42d36d2b284.tar.gz
hydrilla-builder-83fcfd7c39b7f425c43c86bd2907b42d36d2b284.zip
only block 'requests' library for tests if it is presentHEADv1.1-beta1masterkoszko
Diffstat (limited to 'conftest.py')
-rw-r--r--conftest.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/conftest.py b/conftest.py
index e41a61d..f49d30f 100644
--- a/conftest.py
+++ b/conftest.py
@@ -9,6 +9,7 @@ from pathlib import Path
import pytest
import pkgutil
+import importlib
from tempfile import TemporaryDirectory
from typing import Iterable
@@ -18,7 +19,8 @@ sys.path.insert(0, str(here / 'src'))
@pytest.fixture(autouse=True)
def no_requests(monkeypatch):
"""Remove requests.sessions.Session.request for all tests."""
- monkeypatch.delattr('requests.sessions.Session.request')
+ if importlib.util.find_spec("requests") is not None:
+ monkeypatch.delattr('requests.sessions.Session.request')
@pytest.fixture
def mock_subprocess_run(monkeypatch, request):