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.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
|
import platform
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
@ -6,6 +7,8 @@ import pytest
|
|||||||
import mmengine
|
import mmengine
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(
|
||||||
|
platform.system() != 'Linux', reason='Only test `Timer` in linux!')
|
||||||
def test_timer_init():
|
def test_timer_init():
|
||||||
timer = mmengine.Timer(start=False)
|
timer = mmengine.Timer(start=False)
|
||||||
assert not timer.is_running
|
assert not timer.is_running
|
||||||
@ -15,6 +18,8 @@ def test_timer_init():
|
|||||||
assert timer.is_running
|
assert timer.is_running
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(
|
||||||
|
platform.system() != 'Linux', reason='Only test `Timer` in linux!')
|
||||||
def test_timer_run():
|
def test_timer_run():
|
||||||
timer = mmengine.Timer()
|
timer = mmengine.Timer()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
@ -31,6 +36,8 @@ def test_timer_run():
|
|||||||
timer.since_last_check()
|
timer.since_last_check()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(
|
||||||
|
platform.system() != 'Linux', reason='Only test `Timer` in linux!')
|
||||||
def test_timer_context(capsys):
|
def test_timer_context(capsys):
|
||||||
with mmengine.Timer():
|
with mmengine.Timer():
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user