client_fixture.py
import pytest
from app.apis import api
from app import create_app
@pytest.fixture
def app_client(credentials, redis_cred_setup):
app = create_app(credentials['app_config_name'])
api.init_app(app)
client = app.test_client()
return client
我在app
包中的create_app()
内有fixture和函数__init__.py
但是这个固定装置产生了一个错误
ImportError: Error importing plugin "client_fixtures": No module named 'app'
包装结构
^{pr2}$Maybe it will be helpful
当我用PyCharm运行测试时,一切正常 我只需在tests文件夹上单击鼠标右键并执行'Runpy.测试测试中
您需要调用
pytest
,如下所示:从documentation:
相关问题 更多 >
编程相关推荐