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
패키지
에 __init__.py
내부의기구와 기능 create_app()
을 가지고 있지만,이기구는 오류가 발생
ImportError: Error importing plugin "client_fixtures": No module named 'app'
패키지 구조 어쩌면
Core
app-
...
__init__.py
tests-
client_fixture.py
는
내가 다 난 그냥 테스트 폴더에 마우스 오른쪽 버튼을 클릭하고 실행 작업, PyCharm를 사용하여 테스트를 실행
`실행 py.test 도움이 될 것입니다 에서 테스트 '당신은 같은pytest
호출 할 필요가
테스트를 시작한 방법과 작업 디렉토리는 어디에서 시작 했습니까? –
편집 됨 @KlausD. Core dir에서'pytest' 명령을 사용하여 프로그램을 실행합니다. –
'Core' 디렉토리에서 테스트를 실행해야합니다. –