Skip to content

Commit 7c1cf21

Browse files
committed
TST: release testing of downstream packages
1 parent baa264c commit 7c1cf21

File tree

4 files changed

+31
-17
lines changed

4 files changed

+31
-17
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ after_success:
123123

124124
after_script:
125125
- echo "after_script start"
126-
- source activate pandas && python -c "import pandas; pandas.show_versions();"
126+
- source activate pandas && cd /tmp && python -c "import pandas; pandas.show_versions();"
127127
- if [ -e /tmp/single.xml ]; then
128128
ci/print_skipped.py /tmp/single.xml;
129129
fi

ci/script_multi.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ if [ "$BUILD_TEST" ]; then
2727
echo "[running]"
2828
cd /tmp
2929
unset PYTHONPATH
30-
python -c "import pandas; pandas.test(['-n 2'])"
30+
python -c "import pandas; pandas.test(['-n 2', '--skip-slow', '--skip-network', '-r xX'])"
3131

3232
elif [ "$DOC" ]; then
3333
echo "We are not running pytest as this is a doc-build"
@@ -37,8 +37,8 @@ elif [ "$COVERAGE" ]; then
3737
pytest -s -n 2 -m "not single" --cov=pandas --cov-report xml:/tmp/cov-multiple.xml --junitxml=/tmp/multiple.xml $TEST_ARGS pandas
3838

3939
else
40-
echo pytest -n 2 -m "not single" --junitxml=/tmp/multiple.xml $TEST_ARGS pandas
41-
pytest -n 2 -m "not single" --junitxml=/tmp/multiple.xml $TEST_ARGS pandas # TODO: doctest
40+
echo pytest -n 2 -r xX -m "not single" --junitxml=/tmp/multiple.xml $TEST_ARGS pandas
41+
pytest -n 2 -m -r xX "not single" --junitxml=/tmp/multiple.xml $TEST_ARGS pandas # TODO: doctest
4242
fi
4343

4444
RET="$?"

ci/script_single.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ elif [ "$COVERAGE" ]; then
2020
echo pytest -s -m "single" --cov=pandas --cov-report xml:/tmp/cov-single.xml --junitxml=/tmp/single.xml $TEST_ARGS pandas
2121
pytest -s -m "single" --cov=pandas --cov-report xml:/tmp/cov-single.xml --junitxml=/tmp/single.xml $TEST_ARGS pandas
2222
else
23-
echo pytest -m "single" --junitxml=/tmp/single.xml $TEST_ARGS pandas
24-
pytest -m "single" --junitxml=/tmp/single.xml $TEST_ARGS pandas # TODO: doctest
23+
echo pytest -m "single" -r xX --junitxml=/tmp/single.xml $TEST_ARGS pandas
24+
pytest -m "single" -r xX --junitxml=/tmp/single.xml $TEST_ARGS pandas # TODO: doctest
2525
fi
2626

2727
RET="$?"

pandas/tests/test_downstream.py

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,19 @@
55
import numpy as np # noqa
66
from pandas import DataFrame
77
from pandas.util import testing as tm
8+
import importlib
9+
10+
11+
def import_module(name):
12+
# we *only* want to skip if the module is truly not available
13+
# and NOT just an actual import error because of pandas changes
14+
15+
try:
16+
return importlib.import_module(name)
17+
except ImportError as e:
18+
if "No module named {}".format(name) in str(e):
19+
pytest.skip("skipping as {} not available".format(name))
20+
raise
821

922

1023
@pytest.fixture
@@ -14,8 +27,8 @@ def df():
1427

1528
def test_dask(df):
1629

17-
toolz = pytest.importorskip('toolz') # noqa
18-
dask = pytest.importorskip('dask') # noqa
30+
toolz = import_module('toolz') # noqa
31+
dask = import_module('dask') # noqa
1932

2033
import dask.dataframe as dd
2134

@@ -26,14 +39,14 @@ def test_dask(df):
2639

2740
def test_xarray(df):
2841

29-
xarray = pytest.importorskip('xarray') # noqa
42+
xarray = import_module('xarray') # noqa
3043

3144
assert df.to_xarray() is not None
3245

3346

3447
def test_statsmodels():
3548

36-
statsmodels = pytest.importorskip('statsmodels') # noqa
49+
statsmodels = import_module('statsmodels') # noqa
3750
import statsmodels.api as sm
3851
import statsmodels.formula.api as smf
3952
df = sm.datasets.get_rdataset("Guerry", "HistData").data
@@ -42,7 +55,7 @@ def test_statsmodels():
4255

4356
def test_scikit_learn(df):
4457

45-
sklearn = pytest.importorskip('sklearn') # noqa
58+
sklearn = import_module('sklearn') # noqa
4659
from sklearn import svm, datasets
4760

4861
digits = datasets.load_digits()
@@ -53,33 +66,34 @@ def test_scikit_learn(df):
5366

5467
def test_seaborn():
5568

56-
seaborn = pytest.importorskip('seaborn')
69+
seaborn = import_module('seaborn')
5770
tips = seaborn.load_dataset("tips")
5871
seaborn.stripplot(x="day", y="total_bill", data=tips)
5972

6073

6174
def test_pandas_gbq(df):
6275

63-
pandas_gbq = pytest.importorskip('pandas-gbq') # noqa
76+
pandas_gbq = import_module('pandas_gbq') # noqa
6477

6578

66-
@tm.network
79+
@pytest.mark.xfail(reason=("pandas_datareader<=0.3.0 "
80+
"broken w.r.t. pandas >= 0.20.0"))
6781
def test_pandas_datareader():
6882

69-
pandas_datareader = pytest.importorskip('pandas-datareader') # noqa
83+
pandas_datareader = import_module('pandas_datareader') # noqa
7084
pandas_datareader.get_data_yahoo('AAPL')
7185

7286

7387
def test_geopandas():
7488

75-
geopandas = pytest.importorskip('geopandas') # noqa
89+
geopandas = import_module('geopandas') # noqa
7690
fp = geopandas.datasets.get_path('naturalearth_lowres')
7791
assert geopandas.read_file(fp) is not None
7892

7993

8094
def test_pyarrow(df):
8195

82-
pyarrow = pytest.importorskip('pyarrow') # noqa
96+
pyarrow = import_module('pyarrow') # noqa
8397
table = pyarrow.Table.from_pandas(df)
8498
result = table.to_pandas()
8599
tm.assert_frame_equal(result, df)

0 commit comments

Comments
 (0)