Skip to content
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

adds multi-OS support to travis CI #124

Merged
merged 8 commits into from
Dec 17, 2019
104 changes: 81 additions & 23 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,88 @@
language: python
dist: xenial
python:
- "3.5"
- "3.6"
- "3.7"
language: bash

cache:
directories:
- $HOME/miniconda3

before_cache:
- rm -rf $CONDA_DIR/pkgs/cache
- rm -rf $CONDA_DIR/envs/hosts
- rm -rf $CONDA_DIR/conda-meta/history
- touch $CONDA_DIR/conda-meta/history

os:
- linux
- osx
- windows

env:
- PYTHON_VERSION="3.5"
- PYTHON_VERSION="3.6"
- PYTHON_VERSION="3.7"

before_install:
- |
export CONDA_DIR="$HOME/miniconda3"
if [ "${TRAVIS_OS_NAME}" == "windows" ]; then
export CONDA_DIR=`cygpath -w $CONDA_DIR`
export CONDA_BIN_DIR="$CONDA_DIR\scripts"
else
export CONDA_BIN_DIR="$CONDA_DIR/bin"
fi
export PATH="$CONDA_BIN_DIR:$PATH"

install:
- sudo apt-get update
# We do this conditionally because it saves us some downloading if the
# version is the same.
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda update -q --yes conda
# Useful for debugging any issues with conda
- conda info -a
- conda create -q -n ci-env python=$TRAVIS_PYTHON_VERSION
- source activate ci-env
- conda install -y -c conda-forge numpy scipy pandas codecov
- pip install -r requirements.txt
- python setup.py install
# Install Conda
- |
if [ "${TRAVIS_OS_NAME}" == "windows" ]; then
choco install openssl.light
fi

if [ -d "$CONDA_DIR" ] && [ -e "$CONDA_BIN_DIR/conda" ]; then
echo "Miniconda install already present from cache: $CONDA_DIR"
rm -rf $CONDA_DIR/envs/hosts # Just in case...
else
echo "Installing Miniconda..."
rm -rf $CONDA_DIR # Just in case...

if [ "${TRAVIS_OS_NAME}" == "windows" ]; then
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Windows-x86_64.exe -O miniconda.exe || exit 1
cmd //c "start /wait "" miniconda.exe /S /D=$CONDA_DIR"
else
if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
wget https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O miniconda.sh || exit 1
elif [ "${TRAVIS_OS_NAME}" == "linux" ]; then
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh || exit 1
fi
bash miniconda.sh -b -p "$CONDA_DIR" || exit 1
fi
fi

echo "Configuring Miniconda..."
conda config --set ssl_verify false || exit 1
conda config --set always_yes true --set changeps1 false || exit 1

echo "Updating Miniconda..."
conda update conda
conda update --all
conda info -a || exit 1
# Setup Conda Env
- |
echo "Creating a Python $PYTHON_VERSION environment..."
conda create -n hosts python=$PYTHON_VERSION || exit 1
source activate hosts

echo "Installing packages..."
conda install numpy scipy pandas codecov
pip install -r requirements.txt
python setup.py install
conda list

script:
- source activate hosts
- pytest --cov=pandera tests/
- codecov
# Check conformity to flake8 style guide
- flake8 pandera/pandera.py tests
# Check docs can build, treating warnings as errors
- make -C docs doctest && python -m sphinx -E -W "docs/source" "docs/_build"
- python -m sphinx -E -W -b=doctest "docs/source" "docs/_build"
3 changes: 3 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
]

doctest_global_setup = """
import pandas as pd
pd.options.display.max_columns = None # For Travis on macOS
pd.options.display.max_rows = None # For Travis on macOS
"""

doctest_default_flags = (
Expand Down
11 changes: 11 additions & 0 deletions tests/test_docs_setting_column_widths.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import pandas as pd
from docs.source import conf


def test_sphinx_doctest_setting_global_pandas_conditions():
exec(conf.doctest_global_setup)

max_cols_after_being_set = pd.options.display.max_columns
max_rows_after_being_set = pd.options.display.max_rows
assert max_cols_after_being_set is None
assert max_rows_after_being_set is None