Revision 2fc043b3
Added by koszko about 1 year ago
- ID 2fc043b30a492d69bb00912867d6d27541419ebc
- Parent ce480820
conftest.py | ||
---|---|---|
9 | 9 |
|
10 | 10 |
import pytest |
11 | 11 |
import pkgutil |
12 |
import importlib |
|
12 | 13 |
from tempfile import TemporaryDirectory |
13 | 14 |
from typing import Iterable |
14 | 15 |
|
... | ... | |
18 | 19 |
@pytest.fixture(autouse=True) |
19 | 20 |
def no_requests(monkeypatch): |
20 | 21 |
"""Remove requests.sessions.Session.request for all tests.""" |
21 |
monkeypatch.delattr('requests.sessions.Session.request') |
|
22 |
if importlib.util.find_spec("requests") is not None: |
|
23 |
monkeypatch.delattr('requests.sessions.Session.request') |
|
22 | 24 |
|
23 | 25 |
@pytest.fixture |
24 | 26 |
def mock_subprocess_run(monkeypatch, request): |
Also available in: Unified diff
only block 'requests' library for tests if it is present