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
Coarser Fixture Scopes #50
Comments
@bradmwalker I'd stronglu suggest rather changing the session-scoped SQLAlchemy engine to be rather function scoped. Se conftest.py for my pyramid_fullath pyramid's plugin: https://github.com/fizyk/pyramid_fullauth/blob/master/tests/conftest.py#L39 Session living in between tests suggest that the data might live also affecting other tests. Clean slate for each test is always preferable. |
I use one session-scoped fixture for SA engine + sessionmaker initialization (and potentially schema initialization), and a dependent function-scoped fixture to yield individual sessions from the sessionmaker for clean state. Session-scoping might be a sane default for the configuration fixture. Websauna sets session-scoping for its config and WSGI app fixtures: https://websauna.org/_modules/websauna/tests/conftest.html |
Well... you might be right, that the config is simple enough to be session scoped anyway. It's not like it's a database... |
change pyramid_config fixture scope to session - closes #50.
@bradmwalker version 0.3.0 should be in a minute uploaded to pypi. Thanks for pointing out that the config fixture could be rather session scoped. Happy testing. |
My conftest.py, probably non-ideal, attempts to depend a session-scoped SQLAlchemy engine upon the pyramid_config fixture. Py.test disallows depending a session-scoped fixture on another function-scoped fixture. A knob to control pyramid_config granularity would be nice.
The text was updated successfully, but these errors were encountered: