@pytest.mark.skipif 装饰器根据指定条件跳过测试,比如在特定 Python 版本下跳过测试。
import pytest
import sys
@pytest.mark.skipif(sys.version_info < (3, 6), reason="Requires Python 3.6 or higher")
def test_python_version():
assert True
@pytest.mark.skipif 装饰器根据指定条件跳过测试,比如在特定 Python 版本下跳过测试。
import pytest
import sys
@pytest.mark.skipif(sys.version_info < (3, 6), reason="Requires Python 3.6 or higher")
def test_python_version():
assert True
Sign in to comment and like
No comments yet.