Skip to content

test: prevent CLI tests from leaking artifacts#2446

Open
Dev-iL wants to merge 3 commits into
dpgaspar:masterfrom
Dev-iL:2606/test_isolation
Open

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

Conversation

@Dev-iL

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

Copy link
Copy Markdown

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 Dev-iL force-pushed the 2606/test_isolation branch from ba4172a to ae11381 Compare March 22, 2026 14:25
@Dev-iL Dev-iL force-pushed the 2606/test_isolation branch from ae11381 to 0c74513 Compare April 9, 2026 05:34
@codecov

codecov Bot commented Apr 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.75%. Comparing base (eefc219) to head (c95a590).
⚠️ Report is 7 commits behind head on master.

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     
Flag Coverage Δ
python 79.75% <100.00%> (-0.17%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Dev-iL Dev-iL force-pushed the 2606/test_isolation branch 2 times, most recently from 096ae79 to c95a590 Compare April 9, 2026 18:33
@Dev-iL Dev-iL force-pushed the 2606/test_isolation branch 2 times, most recently from 0594dde to 57c7358 Compare June 13, 2026 06:17
Dev-iL added 2 commits June 13, 2026 09:33
- 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 57c7358 to 31b88e9 Compare June 13, 2026 08:44
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