pytest fixtures in a separate directory

后端 未结 3 896
渐次进展
渐次进展 2020-12-16 14:35

I\'m looking to create a pytest structure where I can separate the fixtures from the tests completely. The reason for this separation is that I want to include the fixtures

3条回答
  •  一向
    一向 (楼主)
    2020-12-16 15:23

    read here how structure your test.

    your fixture directory seems not in package (project does not have __init__.py so canno be imported as project.fixtures either as fixtures as is not in the path. You can add required dirs in the path in your tests/conftest.py (sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, "fixtures")) or sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir) depending how how you want import your modules.

提交回复
热议问题