test: prevent CLI tests from leaking artifacts#2446
Open
Dev-iL wants to merge 2 commits intodpgaspar:masterfrom
Open
test: prevent CLI tests from leaking artifacts#2446Dev-iL wants to merge 2 commits intodpgaspar:masterfrom
Dev-iL wants to merge 2 commits intodpgaspar:masterfrom
Conversation
- 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.
ba4172a to
ae11381
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