Skip to content

Commit

Permalink
TestTicTacToc: Skip test_loop and test_timer for darwin
Browse files Browse the repository at this point in the history
  • Loading branch information
rht committed Dec 10, 2018
1 parent 6e5cd89 commit 57ba55b
Showing 1 changed file with 11 additions and 2 deletions.
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

0 comments on commit 57ba55b

Please sign in to comment.