Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 771707f

Browse filesBrowse files
authored
Merge pull request #6923 from astrofrog/nose-optional
MNT: Make sure nose is only imported when needed
2 parents 7d25ee8 + 360b8c0 commit 771707f
Copy full SHA for 771707f

File tree

Expand file treeCollapse file tree

1 file changed

+7
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-1
lines changed

‎lib/matplotlib/testing/decorators.py

Copy file name to clipboardExpand all lines: lib/matplotlib/testing/decorators.py
+7-1Lines 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
@@ -417,6 +420,9 @@ def find_dotted_module(module_name, path=None):
417420

418421

419422
def switch_backend(backend):
423+
# Local import to avoid a hard nose dependency and only incur the
424+
# import time overhead at actual test-time.
425+
import nose
420426
def switch_backend_decorator(func):
421427
def backend_switcher(*args, **kwargs):
422428
try:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.