-
Notifications
You must be signed in to change notification settings - Fork 1
/
conftest.py
41 lines (36 loc) · 1.09 KB
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"""
Pytest configuration file for the entire application
"""
# pylint: disable=redefined-outer-name
import warnings
import pytest
import requests_mock
@pytest.fixture(autouse=True)
def warnings_as_errors():
"""
Convert warnings to errors. This should only affect unit tests, letting pylint and other plugins
raise DeprecationWarnings without erroring.
"""
try:
warnings.resetwarnings()
warnings.simplefilter("error")
# For celery
warnings.simplefilter("ignore", category=ImportWarning)
warnings.filterwarnings(
"ignore",
message="'async' and 'await' will become reserved keywords in Python 3.7",
category=DeprecationWarning,
)
warnings.filterwarnings(
"ignore",
message="stream argument is deprecated. Use stream parameter in request directly",
category=DeprecationWarning,
)
yield
finally:
warnings.resetwarnings()
@pytest.fixture
def reqmocker():
"""Fixture for requests mock"""
with requests_mock.Mocker() as m:
yield m