-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using live_server fixture leads to ScopeMismatch Error #117
Comments
Please change your @pytest.fixture(scope="session")
def app():
app = create_app()
return app Does that fix it? |
As #117 shows, it is indeed confusing now that the default `live_server` is session-scoped.
Btw thanks for noticing this, I have updated the docs: the Closing for now, feel free to follow up with further questions though. 👍 |
Thanks for the response! That got rid of the initial error, but now I'm getting the same error mentioned on #54 . I'll try the workaround/s mentioned in that thread. |
- Travis is no longer on the default dashboard - Fix pickling error based on pytest-dev/pytest-flask#104 - Fix fixture scoping based on pytest-dev/pytest-flask#117
I'm trying to do the most basic live server test (based on Quickstart and documentation) and despite doing the most bare-bones example possible, I keep getting
ScopeMismatch: You tried to access the 'function' scoped fixture 'app' with a 'session' scoped request object, involved factories
when running the test.app.py looks like this:
conftest.py looks like this
And finally test_app.py looks like this
(Don't be confused as to why the test is just
assert True
. I've also tried it with using urllib to open a URL then checking the code but that failed the same way as well. I was hoping doing a basic test that doesn't even use the live server would help resolve the issue but it didn't.)Python 3.8.1
Flask 1.1.1
pytest==5.3.5
pytest-flask==1.0.0
The text was updated successfully, but these errors were encountered: