Skip to content

Commit 38acedc

Browse files
committed
Merge pull request #35 from dukebody/fix_tests
Correctly install and use mock module for python 2 and 3.
2 parents cc906f6 + 1674b97 commit 38acedc

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

tests/test_dataframe_mapper.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import pytest
2-
from mock import Mock
2+
3+
# In py3, mock is included with the unittest standard library
4+
# In py2, it's a separate package
5+
try:
6+
from unittest.mock import Mock
7+
except ImportError:
8+
from mock import Mock
39

410
from pandas import DataFrame
511
import pandas as pd

tox.ini

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ deps =
88
setuptools==16.0
99
wheel==0.24.0
1010
flake8==2.4.1
11+
py27: mock==1.3.0
1112

1213
commands =
1314
pip install numpy --no-index
@@ -16,4 +17,4 @@ commands =
1617
pip install scikit-learn --no-index
1718
python setup.py develop
1819
flake8 tests
19-
py.test
20+
py.test

0 commit comments

Comments
 (0)