Skip to content

TST: release testing of downstream #16261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ after_success:

after_script:
- echo "after_script start"
- source activate pandas && python -c "import pandas; pandas.show_versions();"
- source activate pandas && cd /tmp && python -c "import pandas; pandas.show_versions();"
- if [ -e /tmp/single.xml ]; then
ci/print_skipped.py /tmp/single.xml;
fi
Expand Down
27 changes: 16 additions & 11 deletions ci/install_travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,7 @@ if [ "$COVERAGE" ]; then
fi

echo
if [ "$BUILD_TEST" ]; then

# build & install testing
echo ["Starting installation test."]
bash ci/install_release_build.sh
conda uninstall -y cython
time pip install dist/*tar.gz || exit 1

else
if [ -z "$BUILD_TEST" ]; then

# build but don't install
echo "[build em]"
Expand Down Expand Up @@ -163,9 +155,22 @@ fi
# w/o removing anything else
echo
echo "[removing installed pandas]"
conda remove pandas --force
conda remove pandas -y --force

if [ -z "$BUILD_TEST" ]; then
if [ "$BUILD_TEST" ]; then

# remove any installation
pip uninstall -y pandas
conda list pandas
pip list --format columns |grep pandas

# build & install testing
echo ["building release"]
bash scripts/build_dist_for_release.sh
conda uninstall -y cython
time pip install dist/*tar.gz || exit 1

else

# install our pandas
echo
Expand Down
20 changes: 13 additions & 7 deletions ci/script_multi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,26 @@ export PYTHONHASHSEED=$(python -c 'import random; print(random.randint(1, 429496
echo PYTHONHASHSEED=$PYTHONHASHSEED

if [ "$BUILD_TEST" ]; then
echo "build-test"
echo "[build-test]"

echo "[env]"
pip list --format columns |grep pandas

echo "[running]"
cd /tmp
pwd
conda list pandas
echo "running"
python -c "import pandas; pandas.test(['-n 2'])"
unset PYTHONPATH
python -c "import pandas; pandas.test(['-n 2', '--skip-slow', '--skip-network', '-r xX'])"

elif [ "$DOC" ]; then
echo "We are not running pytest as this is a doc-build"

elif [ "$COVERAGE" ]; then
echo pytest -s -n 2 -m "not single" --cov=pandas --cov-report xml:/tmp/cov-multiple.xml --junitxml=/tmp/multiple.xml $TEST_ARGS pandas
pytest -s -n 2 -m "not single" --cov=pandas --cov-report xml:/tmp/cov-multiple.xml --junitxml=/tmp/multiple.xml $TEST_ARGS pandas

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

RET="$?"
Expand Down
4 changes: 2 additions & 2 deletions ci/script_single.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ elif [ "$COVERAGE" ]; then
echo pytest -s -m "single" --cov=pandas --cov-report xml:/tmp/cov-single.xml --junitxml=/tmp/single.xml $TEST_ARGS pandas
pytest -s -m "single" --cov=pandas --cov-report xml:/tmp/cov-single.xml --junitxml=/tmp/single.xml $TEST_ARGS pandas
else
echo pytest -m "single" --junitxml=/tmp/single.xml $TEST_ARGS pandas
pytest -m "single" --junitxml=/tmp/single.xml $TEST_ARGS pandas # TODO: doctest
echo pytest -m "single" -r xX --junitxml=/tmp/single.xml $TEST_ARGS pandas
pytest -m "single" -r xX --junitxml=/tmp/single.xml $TEST_ARGS pandas # TODO: doctest
fi

RET="$?"
Expand Down
44 changes: 33 additions & 11 deletions pandas/tests/test_downstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,28 @@
import pytest
import numpy as np # noqa
from pandas import DataFrame
from pandas.compat import PY36
from pandas.util import testing as tm
import importlib


def import_module(name):
# we *only* want to skip if the module is truly not available
# and NOT just an actual import error because of pandas changes

if PY36:
try:
return importlib.import_module(name)
except ModuleNotFoundError: # noqa
pytest.skip("skipping as {} not available".format(name))

else:
try:
return importlib.import_module(name)
except ImportError as e:
if "No module named" in str(e) and name in str(e):
pytest.skip("skipping as {} not available".format(name))
raise


@pytest.fixture
Expand All @@ -14,8 +35,8 @@ def df():

def test_dask(df):

toolz = pytest.importorskip('toolz') # noqa
dask = pytest.importorskip('dask') # noqa
toolz = import_module('toolz') # noqa
dask = import_module('dask') # noqa

import dask.dataframe as dd

Expand All @@ -26,14 +47,14 @@ def test_dask(df):

def test_xarray(df):

xarray = pytest.importorskip('xarray') # noqa
xarray = import_module('xarray') # noqa

assert df.to_xarray() is not None


def test_statsmodels():

statsmodels = pytest.importorskip('statsmodels') # noqa
statsmodels = import_module('statsmodels') # noqa
import statsmodels.api as sm
import statsmodels.formula.api as smf
df = sm.datasets.get_rdataset("Guerry", "HistData").data
Expand All @@ -42,7 +63,7 @@ def test_statsmodels():

def test_scikit_learn(df):

sklearn = pytest.importorskip('sklearn') # noqa
sklearn = import_module('sklearn') # noqa
from sklearn import svm, datasets

digits = datasets.load_digits()
Expand All @@ -53,33 +74,34 @@ def test_scikit_learn(df):

def test_seaborn():

seaborn = pytest.importorskip('seaborn')
seaborn = import_module('seaborn')
tips = seaborn.load_dataset("tips")
seaborn.stripplot(x="day", y="total_bill", data=tips)


def test_pandas_gbq(df):

pandas_gbq = pytest.importorskip('pandas-gbq') # noqa
pandas_gbq = import_module('pandas_gbq') # noqa


@tm.network
@pytest.mark.xfail(reason=("pandas_datareader<=0.3.0 "
"broken w.r.t. pandas >= 0.20.0"))
def test_pandas_datareader():

pandas_datareader = pytest.importorskip('pandas-datareader') # noqa
pandas_datareader = import_module('pandas_datareader') # noqa
pandas_datareader.get_data_yahoo('AAPL')


def test_geopandas():

geopandas = pytest.importorskip('geopandas') # noqa
geopandas = import_module('geopandas') # noqa
fp = geopandas.datasets.get_path('naturalearth_lowres')
assert geopandas.read_file(fp) is not None


def test_pyarrow(df):

pyarrow = pytest.importorskip('pyarrow') # noqa
pyarrow = import_module('pyarrow') # noqa
table = pyarrow.Table.from_pandas(df)
result = table.to_pandas()
tm.assert_frame_equal(result, df)
6 changes: 1 addition & 5 deletions scripts/build_dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@ read -p "Ok to continue (y/n)? " answer
case ${answer:0:1} in
y|Y )
echo "Building distribution"
rm -rf dist
git clean -xfd
python setup.py clean
python setup.py cython
python setup.py sdist --formats=gztar
./build_dist_for_release.sh
;;
* )
echo "Not building distribution"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# this requires cython to be installed

# this builds the release cleanly
# this builds the release cleanly & is building on the current checkout
rm -rf dist
git clean -xfd
python setup.py clean
Expand Down