【发布时间】:2020-04-07 04:37:30
【问题描述】:
我有一个使用标记的版本分隔的测试:
例子:
@pytest.mark.version("1.0")
def test_does_something():
assert 1
@pytest.mark.version("1.0.1")
def test_does_another_thing():
assert 0
@pytest.mark.version("1.1.1")
def test_does_nothing():
assert 0
@pytest.mark.version("2.3.1")
def test_example():
assert 1
这个想法是根据命令行传递的标记值执行测试,例如:
pytest my_file.py -m "version("1.1") and version("2.3.1")
【问题讨论】:
标签: python pytest command-line-arguments