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 48dedc4

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

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
@@ -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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.