在以下目录结构中:
tests/
└───asod/
├───__init__.py
└───bsod/
├───__init__.py
└───dra.py
我有以下文件:
asod/\uu init\uuuuuuu.py
from .bsod import *
asod/bsod/\uu init\uuuu.py
from .dra import *
asod/bsod/dra.py
import pytest
class TestDra:
@pytest.mark.debug
def test_1(self):
assert 1 == 1
pytest.ini的内容
[pytest]
addopts = --disable-pytest-warnings --color=yes --verbose
python_files = *.py
markers =
debug: mark a test for debugging purposes.
标记用于与其他测试分开运行test_1
。
在运行pytest时,它会运行测试3次:
tests\asod\__init__.py::TestDra::test_1 <- asod\bsod\dra.py PASSED [ 33%]
tests\asod\bsod\__init__.py::TestDra::test_1 <- asod\bsod\dra.py PASSED [ 66%]
tests\asod\bsod\dra.py::TestDra::test_1 PASSED [100%]
如何防止重复测试
drop-dup-tests-0.1.0插件并不能阻止这种情况。 使用Python3.7.0和pytest5.2.1
目前没有回答
相关问题 更多 >
编程相关推荐