test: prevent CLI tests from leaking artifacts#2446
Open
Dev-iL wants to merge 3 commits into
Open
Conversation
ba4172a to
ae11381
Compare
ae11381 to
0c74513
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2446 +/- ##
==========================================
- Coverage 79.91% 79.75% -0.17%
==========================================
Files 81 81
Lines 9183 9250 +67
==========================================
+ Hits 7339 7377 +38
- Misses 1844 1873 +29
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
096ae79 to
c95a590
Compare
0594dde to
57c7358
Compare
- Add `tearDownModule` to `test_api.py` and `test_mvc.py` to remove the file-based SQLite DB (`app.db`) after each module run, preventing stale state from polluting subsequent runs. This fixes `test_permission_converge_compress` which failed due to leftover "test" user/role data from previous runs. - Fix `test_fab_cli.py` tests to use `tempfile` for DB and export files: - Override `SQLALCHEMY_DATABASE_URI` in export tests so `src.db` goes to a temp dir instead of `tests/` - Wrap test_export_roles_indent in `TemporaryDirectory` + `os.chdir` so `roles_export_*.json` files don't leak into the working tree.
57c7358 to
31b88e9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
tearDownModuletotest_api.pyandtest_mvc.pyto remove the file-based SQLite DB (app.db) after each module run, preventing stale state from polluting subsequent runs. This fixestest_permission_converge_compresswhich failed due to leftover "test" user/role data from previous runs.test_fab_cli.pytests to usetempfilefor DB and export files:SQLALCHEMY_DATABASE_URIin export tests sosrc.dbgoes to a temp dir instead oftests/TemporaryDirectory+os.chdirsoroles_export_*.jsonfiles don't leak into the working tree.depends on: #2444
ADDITIONAL INFORMATION