Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

feature(testing): pytest plugin #246

Merged
merged 7 commits into from
Jan 16, 2023
Merged

feature(testing): pytest plugin #246

merged 7 commits into from
Jan 16, 2023

Conversation

peterschutt
Copy link
Member

No description provided.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@peterschutt peterschutt merged commit 7480356 into 0.28 Jan 16, 2023
@peterschutt peterschutt deleted the pytest-plugin branch January 16, 2023 05:03
@peterschutt peterschutt mentioned this pull request Jan 16, 2023
peterschutt added a commit that referenced this pull request 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 pull request 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.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant