Skip to content

Commit 47a36ba

Browse files
committed
Merge pull request #3189 from matthew-brett/use-unittest-mock
BUG: use unittest.mock for Python 3.3+
2 parents b4a678a + 672a88a commit 47a36ba

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

lib/matplotlib/tests/test_dates.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@
99
import tempfile
1010

1111
import dateutil
12-
import mock
12+
try:
13+
# mock in python 3.3+
14+
from unittest import mock
15+
except ImportError:
16+
import mock
1317
from nose.tools import assert_raises, assert_equal
1418

1519
from matplotlib.testing.decorators import image_comparison, cleanup

lib/matplotlib/tests/test_legend.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33

44
import six
55
from six.moves import xrange
6-
7-
import mock
6+
try:
7+
# mock in python 3.3+
8+
from unittest import mock
9+
except ImportError:
10+
import mock
811
from nose.tools import assert_equal
912
import numpy as np
1013

lib/matplotlib/tests/test_patheffects.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,19 @@
33

44
import six
55

6-
import mock
7-
from nose.tools import assert_equal
86
import numpy as np
97

108
from matplotlib.testing.decorators import image_comparison, cleanup
119
import matplotlib.pyplot as plt
1210
import matplotlib.patheffects as path_effects
1311

12+
try:
13+
# mock in python 3.3+
14+
from unittest import mock
15+
except ImportError:
16+
import mock
17+
from nose.tools import assert_equal
18+
1419

1520
@image_comparison(baseline_images=['patheffect1'], remove_text=True)
1621
def test_patheffect1():

0 commit comments

Comments
 (0)