From 95c71c82d0da8548baf3f6f9c34dea808ea2f7db Mon Sep 17 00:00:00 2001 From: Mashiro <57566630+HAOCHENYE@users.noreply.github.com> Date: Tue, 13 Dec 2022 19:11:09 +0800 Subject: [PATCH] [Fix] Only test Timer in Linux platform (#823) --- tests/test_utils/test_timer.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/test_utils/test_timer.py b/tests/test_utils/test_timer.py index ac771973..570f7ea3 100644 --- a/tests/test_utils/test_timer.py +++ b/tests/test_utils/test_timer.py @@ -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)