From c0d7441cb75750a468133d6525db5ca3db2c261d Mon Sep 17 00:00:00 2001 From: Kevin Sheppard Date: Fri, 17 Apr 2020 11:35:46 +0100 Subject: [PATCH 1/2] TST: Add a test run on OSX Add a run on OSX --- .travis.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3f86c4c6b1..3e8fe5ff0f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,6 +24,10 @@ env: matrix: fast_finish: true include: + - os: osx + language: generic + env: + - USE_PIP=true - python: 3.7 env: - PYTHON=3.7 @@ -79,7 +83,6 @@ matrix: before_install: - git fetch --tags - - sudo apt-get -y install pandoc # Avoid noise from matplotlib - mkdir -p $HOME/.config/matplotlib # Build package list to avoid empty package=versions @@ -120,7 +123,7 @@ script: - set -e - | if [[ ${DOCBUILD} = true ]]; then - sudo apt-get install -y enchant + sudo apt-get install -y enchant pandoc pip install sphinxcontrib-spelling sphinx-material pip list cd doc From 391880ccd353e79dc5da279d556e45f62231cd68 Mon Sep 17 00:00:00 2001 From: Kevin Sheppard Date: Fri, 17 Apr 2020 12:47:22 +0100 Subject: [PATCH 2/2] Try harder --- .travis.yml | 16 +++++++++------- arch/tests/univariate/test_rescale.py | 7 ++----- ci/travis-osx-setup.sh | 14 ++++++++++++++ 3 files changed, 25 insertions(+), 12 deletions(-) create mode 100644 ci/travis-osx-setup.sh diff --git a/.travis.yml b/.travis.yml index 3e8fe5ff0f..5ec3de0160 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,14 +24,15 @@ env: matrix: fast_finish: true include: - - os: osx - language: generic - env: - - USE_PIP=true - python: 3.7 env: - PYTHON=3.7 - ARCH_CYTHON_COVERAGE=true + - os: osx + osx_image: xcode11.3 + language: generic + env: + - USE_PIP=true - python: 3.8 env: - PYTHON=3.8 @@ -82,6 +83,8 @@ matrix: - PYTEST_PATTERN="(slow or not slow)" before_install: + - source ci/travis-osx-setup.sh + - python --version - git fetch --tags # Avoid noise from matplotlib - mkdir -p $HOME/.config/matplotlib @@ -101,7 +104,7 @@ before_install: install: - | if [[ "$COVERAGE" == true ]]; then - pip install -e . + pip install -e . --no-build-isolation else pip install . fi @@ -109,12 +112,11 @@ install: script: - set -e - python ci/performance.py - - echo pytest -r a -m "$PYTEST_PATTERN" ${COVERAGE_OPTS} --durations=25 arch - | if [[ "$COVERAGE" == true ]]; then + echo pytest -r a -m "$PYTEST_PATTERN" ${COVERAGE_OPTS} --durations=25 arch/tests/univariate/test_rescale.py pytest -r a -m "$PYTEST_PATTERN" ${COVERAGE_OPTS} --durations=25 arch else - pip install . mkdir arch_test cd arch_test python -c "import arch; arch.test(['-r a','-m (not slow)'])" diff --git a/arch/tests/univariate/test_rescale.py b/arch/tests/univariate/test_rescale.py index f689674886..1eea9a8c39 100644 --- a/arch/tests/univariate/test_rescale.py +++ b/arch/tests/univariate/test_rescale.py @@ -1,5 +1,3 @@ -import sys - import numpy as np from numpy.testing import assert_allclose import pandas as pd @@ -36,12 +34,11 @@ def test_reproducibility(small_data, small_data2): pd.testing.assert_series_equal(small_data, small_data2) -@pytest.mark.skipif(sys.platform == "darwin", reason="Buggy on OSX/pip NumPy") def test_blank(small_data, std_data): small_mod = ZeroMean(small_data, volatility=GARCH(), rescale=False) - small_res = small_mod.fit(disp="off") + small_res = small_mod.fit() mod = ZeroMean(std_data, volatility=GARCH(), rescale=False) - res = mod.fit(disp="off") + res = mod.fit() assert_allclose(1e3 * small_res.params[0], res.params[0], rtol=5e-3) diff --git a/ci/travis-osx-setup.sh b/ci/travis-osx-setup.sh new file mode 100644 index 0000000000..6650115a65 --- /dev/null +++ b/ci/travis-osx-setup.sh @@ -0,0 +1,14 @@ +if [ "$TRAVIS_OS_NAME" = "osx" ]; then + echo "OSX Python Information" + python3 --version + which python3 + which pip3 + echo unlink /usr/local/bin/python + unlink /usr/local/bin/python + echo ln -s /usr/local/bin/python3 /usr/local/bin/python + ln -s /usr/local/bin/python3 /usr/local/bin/python + echo unlink /usr/local/bin/pip + unlink /usr/local/bin/pip + echo ln -s /usr/local/bin/pip3 /usr/local/bin/pip + ln -s /usr/local/bin/pip3 /usr/local/bin/pip +fi