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

Skip to content

Commit c741f44

Browse files
committed
TST: Force qt?_module fixture to be run first.
If it's not run first, then the `mpl_test_settings` fixture will attempt to switch backends before the skip is triggered.
1 parent 43b5894 commit c741f44

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

lib/matplotlib/tests/test_backend_qt4.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,20 @@
99

1010

1111
@pytest.fixture(autouse=True)
12+
def mpl_test_settings(qt4_module, mpl_test_settings):
13+
"""
14+
Ensure qt4_module fixture is *first* fixture.
15+
16+
We override the `mpl_test_settings` fixture and depend on the `qt4_module`
17+
fixture first. It is very important that it is first, because it skips
18+
tests when Qt4 is not available, and if not, then the main
19+
`mpl_test_settings` fixture will try to switch backends before the skip can
20+
be triggered.
21+
"""
22+
pass
23+
24+
25+
@pytest.fixture
1226
def qt4_module():
1327
try:
1428
import PyQt4

lib/matplotlib/tests/test_backend_qt5.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,20 @@
99

1010

1111
@pytest.fixture(autouse=True)
12+
def mpl_test_settings(qt5_module, mpl_test_settings):
13+
"""
14+
Ensure qt5_module fixture is *first* fixture.
15+
16+
We override the `mpl_test_settings` fixture and depend on the `qt5_module`
17+
fixture first. It is very important that it is first, because it skips
18+
tests when Qt5 is not available, and if not, then the main
19+
`mpl_test_settings` fixture will try to switch backends before the skip can
20+
be triggered.
21+
"""
22+
pass
23+
24+
25+
@pytest.fixture
1226
def qt5_module():
1327
try:
1428
import PyQt5

0 commit comments

Comments
 (0)