mirror of
https://github.com/BOSWatch/BW3-Core.git
synced 2026-04-05 14:25:45 +00:00
improve tests, add is Running prop
This commit is contained in:
parent
cb08ad4e88
commit
362e1001b3
2 changed files with 16 additions and 1 deletions
|
|
@ -44,12 +44,16 @@ class Test_Timer:
|
|||
"""!Server a RepeatedTimer instance with fast worker"""
|
||||
self.testTimer = RepeatedTimer(0.1, Test_Timer.testTargetFast)
|
||||
yield 1 # server the timer instance
|
||||
if self.testTimer.isRunning:
|
||||
self.testTimer.stop()
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
def useTimerSlow(self):
|
||||
"""!Server a RepeatedTimer instance slow worker"""
|
||||
self.testTimer = RepeatedTimer(0.1, Test_Timer.testTargetSlow)
|
||||
yield 1 # server the timer instance
|
||||
if self.testTimer.isRunning:
|
||||
self.testTimer.stop()
|
||||
|
||||
# test cases starts here
|
||||
|
||||
|
|
@ -65,6 +69,11 @@ class Test_Timer:
|
|||
def test_timerStopNotStarted(self, useTimerFast):
|
||||
assert not self.testTimer.stop()
|
||||
|
||||
def test_timerIsRunning(self, useTimerFast):
|
||||
assert self.testTimer.start()
|
||||
assert self.testTimer.isRunning
|
||||
assert self.testTimer.stop()
|
||||
|
||||
def test_timerRun(self, useTimerFast):
|
||||
assert self.testTimer.start()
|
||||
time.sleep(0.2)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue