mirror of
https://github.com/open-mmlab/mmengine.git
synced 2025-06-03 21:54:44 +08:00
[Fix] Only test Timer in Linux platform (#823)
This commit is contained in:
parent
8026b20e68
commit
95c71c82d0
@ -1,4 +1,5 @@
|
||||
# Copyright (c) OpenMMLab. All rights reserved.
|
||||
import platform
|
||||
import time
|
||||
|
||||
import pytest
|
||||
@ -6,6 +7,8 @@ import pytest
|
||||
import mmengine
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
platform.system() != 'Linux', reason='Only test `Timer` in linux!')
|
||||
def test_timer_init():
|
||||
timer = mmengine.Timer(start=False)
|
||||
assert not timer.is_running
|
||||
@ -15,6 +18,8 @@ def test_timer_init():
|
||||
assert timer.is_running
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
platform.system() != 'Linux', reason='Only test `Timer` in linux!')
|
||||
def test_timer_run():
|
||||
timer = mmengine.Timer()
|
||||
time.sleep(1)
|
||||
@ -31,6 +36,8 @@ def test_timer_run():
|
||||
timer.since_last_check()
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
platform.system() != 'Linux', reason='Only test `Timer` in linux!')
|
||||
def test_timer_context(capsys):
|
||||
with mmengine.Timer():
|
||||
time.sleep(1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user