This repository has been archived by the owner on Sep 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Can pytest fixtures be distributed? #106
Comments
Maybe by writing a pytest plugin? I think it should be a matter of adding a [tool.poetry.plugins."pytest11"]
"starlite_salqalchemy" = "starlite_saqlalchemy.testing.pytest" Then fixtures in |
Yes, plugin most likely the way forward! There's also a series of things that I need to monkeypatch for testing every application that would be great to be able to be lifted into the lib here somehow. But that is probably a separate issue, and I'll open that after I finish off a refresh of |
peterschutt
added a commit
that referenced
this issue
Jan 16, 2023
Adds an initial pass at a pytest plugin for testing `starlite-saqlalchemy` applications. Includes the following fixtures: * `is_unit_test`: a boolean that distinguishes between unit and integration tests * `_patch_http_close`: an autouse fixture that prevents any globally instantiated http clients being closed between tests * `_patch_sqlalchemy_plugin`: autouse fixture that patches the sqlalchemy plugin `on_shutdown` method for unittests * `_patch_worker`: autouse fixture that patches the worker `on_app_startup` and `stop` methods for unit tests * `app`: fixture that uses a defined import path to inject an application instance. Default path is `app.main:create_app` * `client`: fixture that injects a starlite `TestClient` instance bound to the same app given by the `app` fixture * `cap_logger`: a structlog capturing logger for inspecting log output Closes #106 Closes #232
peterschutt
added a commit
that referenced
this issue
Jan 16, 2023
Adds an initial pass at a pytest plugin for testing `starlite-saqlalchemy` applications. Includes the following fixtures: * `is_unit_test`: a boolean that distinguishes between unit and integration tests * `_patch_http_close`: an autouse fixture that prevents any globally instantiated http clients being closed between tests * `_patch_sqlalchemy_plugin`: autouse fixture that patches the sqlalchemy plugin `on_shutdown` method for unittests * `_patch_worker`: autouse fixture that patches the worker `on_app_startup` and `stop` methods for unit tests * `app`: fixture that uses a defined import path to inject an application instance. Default path is `app.main:create_app` * `client`: fixture that injects a starlite `TestClient` instance bound to the same app given by the `app` fixture * `cap_logger`: a structlog capturing logger for inspecting log output Closes #106 Closes #232
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Fixtures such as the integration test client, and the caplog fixture would be of benefit downstream if there was a way to make them available.
The text was updated successfully, but these errors were encountered: