test_connectivity.py
:
@pytest.mark.dependency(depends=["test_services_up.py::test_sssss"], scope="session")
def test_aaa():
assert False
@pytest.mark.dependency(depends=["tests/test_services_up.py::test_sssss"], scope="session")
def test_bbb():
assert False
@pytest.mark.dependency(depends=["atp/tests/test_services_up.py::test_sssss"], scope="session")
def test_ccc():
assert False
和test_services_up.py
:
@pytest.mark.dependency()
def test_sssss():
assert True
文件夹结构:
atp
----|tests
--------|test_connectivity.py
--------|test_services_up.py
输出:
> ssh://me@host:port~/src/uv-fleet-atp/venv/bin/python -u ~/.pycharm_helpers/pycharm/_jb_pytest_runner.py --path ~/src/uv-fleet-atp/atp/tests
============================= test session starts ==============================
collected 4 items
test_connectivity.py::test_aaa SKIPPED (test_aaa depends on test_ser...)
Skipped: test_aaa depends on test_services_up.py::test_sssss
test_connectivity.py::test_bbb SKIPPED (test_bbb depends on tests/te...)
Skipped: test_bbb depends on tests/test_services_up.py::test_sssss
test_connectivity.py::test_ccc SKIPPED (test_ccc depends on atp/test...)
Skipped: test_ccc depends on atp/tests/test_services_up.py::test_sssss
test_services_up.py::test_sssss PASSED
========================= 1 passed, 3 skipped in 0.35s =========================
如何不跳过依赖测试?