我是 Python 新手,我对pytest有疑问
test_client.py
# Simple Example tests
import pytest
def test_one():
assert False == False
def test_two():
assert True == True
def cleanup():
# do some cleanup stuff
conftest.py
import pytest
import test_client
@pytest.fixture(scope="session", autouse=True)
def do_clean_up(request):
request.addfinalizer(test_client.cleanup)
是否可以将 conftest.py 中定义的夹具移动到test_client.py从而消除conftest.py