Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 25fdef8

Browse files
committed
Move pytest_configure into installed area.
This allows it to work when run via matplotlib.test().
1 parent bd91b93 commit 25fdef8

File tree

4 files changed

+14
-21
lines changed

4 files changed

+14
-21
lines changed

conftest.py

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from __future__ import (absolute_import, division, print_function,
22
unicode_literals)
33

4-
from matplotlib.tests.conftest import mpl_test_settings
4+
from matplotlib.tests.conftest import (mpl_test_settings,
5+
pytest_configure, pytest_unconfigure)

lib/matplotlib/tests/conftest.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@
66
import matplotlib
77

88

9+
def pytest_configure(config):
10+
matplotlib.use('agg')
11+
matplotlib._called_from_pytest = True
12+
matplotlib._init_tests()
13+
14+
15+
def pytest_unconfigure(config):
16+
matplotlib._called_from_pytest = False
17+
18+
919
@pytest.fixture(autouse=True)
1020
def mpl_test_settings(request):
1121
from matplotlib.testing.decorators import _do_cleanup

lib/mpl_toolkits/tests/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from __future__ import (absolute_import, division, print_function,
22
unicode_literals)
33

4-
from matplotlib.tests.conftest import mpl_test_settings
4+
from matplotlib.tests.conftest import (mpl_test_settings,
5+
pytest_configure, pytest_unconfigure)

0 commit comments

Comments
 (0)