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

Travis: Add macOS to the build matrix #448

Merged
merged 3 commits into from
Dec 10, 2018
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
29 changes: 26 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,31 @@

sudo: false #Use new Container Infrastructure
language: python
python:
- 3.6

cache:
pip: true
directories:
- $HOME/miniconda
# osx-specific caches
- $HOME/Library/Caches/pip

matrix:
include:
- python: 3.6
- os: osx
osx_image: xcode10
sudo: required
env: TRAVIS_PYTHON_VERSION=3.7
language: generic
before_install:
- pip install virtualenv
- virtualenv env -p python3
- source env/bin/activate
- wget https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O miniconda.sh
- chmod +x miniconda.sh
- ./miniconda.sh -u -b -p $HOME/miniconda
- export PATH=$HOME/miniconda/bin:$PATH
- conda update --yes conda

notifications:
email: false
Expand All @@ -18,7 +41,7 @@ branches:
before_install:
- wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
- chmod +x miniconda.sh
- ./miniconda.sh -b -p /home/travis/miniconda
- ./miniconda.sh -u -b -p /home/travis/miniconda
- export PATH=/home/travis/miniconda/bin:$PATH
- conda update --yes conda
#- sudo rm -rf /dev/shm
Expand Down
13 changes: 11 additions & 2 deletions quantecon/util/tests/test_timing.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""

import time
from sys import platform
from numpy.testing import assert_allclose
from nose.tools import eq_, ok_
from quantecon.util import tic, tac, toc, loop_timer
Expand All @@ -15,6 +16,10 @@ def setUp(self):
self.digits = 10

def test_timer(self):
if platform == 'darwin':
# skip for darwin
return

tic()

time.sleep(self.h)
Expand All @@ -32,6 +37,10 @@ def test_timer(self):
assert_allclose(actual, desired, rtol=rtol)

def test_loop(self):
if platform == 'darwin':
# skip for darwin
return

def test_function_one_arg(n):
return time.sleep(n)

Expand All @@ -43,9 +52,9 @@ def test_function_two_arg(n, a):
test_two_arg = \
loop_timer(5, test_function_two_arg, [self.h, 1], digits=10)
for tm in test_one_arg:
assert(abs(tm - self.h) < 0.01)
assert(abs(tm - self.h) < 0.01), tm
for tm in test_two_arg:
assert(abs(tm - self.h) < 0.01)
assert(abs(tm - self.h) < 0.01), tm

for (average_time, average_of_best) in [test_one_arg, test_two_arg]:
ok_(average_time >= average_of_best)
Expand Down