Skip to content

test: prevent CLI tests from leaking artifacts#2446

Open
Dev-iL wants to merge 2 commits intodpgaspar:masterfrom
Dev-iL:2606/test_isolation
Open

test: prevent CLI tests from leaking artifacts#2446
Dev-iL wants to merge 2 commits intodpgaspar:masterfrom
Dev-iL:2606/test_isolation

Conversation

@Dev-iL
Copy link
Copy Markdown

@Dev-iL Dev-iL commented Mar 22, 2026

Description

  • 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.

depends on: #2444

ADDITIONAL INFORMATION

  • Has associated issue:
  • Is CRUD MVC related.
  • Is Auth, RBAC security related.
  • Changes the security db schema.
  • Introduces new feature
  • Removes existing feature

Dev-iL added 2 commits March 19, 2026 19:51
- 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.
@Dev-iL Dev-iL force-pushed the 2606/test_isolation branch from ba4172a to ae11381 Compare March 22, 2026 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant