From 56ff1107012ae207801c93e84f2e6ef53f407f84 Mon Sep 17 00:00:00 2001 From: Smit-create Date: Thu, 3 Nov 2022 14:36:14 +0530 Subject: [PATCH] Also test for darwin --- quantecon/util/tests/test_timing.py | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/quantecon/util/tests/test_timing.py b/quantecon/util/tests/test_timing.py index 161f92687..a869714b1 100644 --- a/quantecon/util/tests/test_timing.py +++ b/quantecon/util/tests/test_timing.py @@ -4,7 +4,6 @@ """ import time -from sys import platform from numpy.testing import assert_allclose, assert_ from quantecon.util import tic, tac, toc, loop_timer @@ -15,9 +14,6 @@ def setup_method(self): self.digits = 10 def test_timer(self): - if platform == 'darwin': - # skip for darwin - return tic() @@ -30,20 +26,14 @@ def test_timer(self): time.sleep(self.h) tm3 = toc() - rtol = 0.1 - - if platform == 'win32': - # pytest platform specific issue - rtol *= 2 + rtol = 0.5 + atol = 0.05 for actual, desired in zip([tm1, tm2, tm3], [self.h, self.h, self.h*3]): - assert_allclose(actual, desired, rtol=rtol) + assert_allclose(actual, desired, atol=atol, rtol=rtol) def test_loop(self): - if platform == 'darwin': - # skip for darwin - return def test_function_one_arg(n): return time.sleep(n) @@ -56,15 +46,13 @@ def test_function_two_arg(n, a): test_two_arg = \ loop_timer(5, test_function_two_arg, [self.h, 1], digits=10) - rtol = 0.1 + rtol = 0.5 + atol = 0.05 - if platform == 'win32': - # pytest platform specific issue - rtol *= 2 for tm in test_one_arg: - assert_allclose(tm, self.h, rtol=rtol) + assert_allclose(tm, self.h, atol=atol, rtol=rtol) for tm in test_two_arg: - assert_allclose(tm, self.h, rtol=rtol) + assert_allclose(tm, self.h, atol=atol, rtol=rtol) for (average_time, average_of_best) in [test_one_arg, test_two_arg]: assert_(average_time >= average_of_best)