Skip to content

Commit 48dedc4

Browse files
committed
Merge pull request #6923 from astrofrog/nose-optional
MNT: Make sure nose is only imported when needed
1 parent edccefa commit 48dedc4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/matplotlib/testing/decorators.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
import warnings
1313
import unittest
1414

15-
import nose
15+
# Note - don't import nose up here - import it only as needed in functions. This
16+
# allows other functions here to be used by pytest-based testing suites without
17+
# requiring nose to be installed.
18+
1619
import numpy as np
1720

1821
import matplotlib as mpl
@@ -412,6 +415,9 @@ def find_dotted_module(module_name, path=None):
412415

413416

414417
def switch_backend(backend):
418+
# Local import to avoid a hard nose dependency and only incur the
419+
# import time overhead at actual test-time.
420+
import nose
415421
def switch_backend_decorator(func):
416422
def backend_switcher(*args, **kwargs):
417423
try:

0 commit comments

Comments
 (0)