Skip to content

Commit b6db393

Browse files
committed
skip TimedBlock tests on Windows
1 parent 09cc274 commit b6db393

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/utils/test_timer.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,22 @@
44
import os
55
import time
66
import pytest
7+
import platform
78

89
import opinf
910

1011

12+
SYSTEM = platform.system()
13+
14+
15+
def skipwindows(func):
16+
17+
def skip(self, *args, **kwargs):
18+
pass
19+
20+
return skip if SYSTEM == "Windows" else func
21+
22+
1123
class MyException(Exception):
1224
pass
1325

@@ -17,6 +29,7 @@ class TestTimedBlock:
1729

1830
Timer = opinf.utils.TimedBlock
1931

32+
@skipwindows
2033
def test_standard(self, message="TimedBlock test, no timelimit"):
2134
# No time limit.
2235
with self.Timer() as obj:
@@ -29,6 +42,7 @@ def test_standard(self, message="TimedBlock test, no timelimit"):
2942
pass
3043
assert obj.message == message
3144

45+
@skipwindows
3246
def test_timeout(self, message="TimedBlock test with problems"):
3347
# Time limit expires.
3448
with pytest.raises(TimeoutError) as ex:
@@ -42,6 +56,7 @@ def test_timeout(self, message="TimedBlock test with problems"):
4256
raise MyException("failure in the block")
4357
assert ex.value.args[0] == "failure in the block"
4458

59+
@skipwindows
4560
def test_log(
4661
self,
4762
message: str = "TimedBlock test with log",

0 commit comments

Comments
 (0)