Skip to content

Fail tests that omit the # do not pre-load pragma - #75

Merged
nonprofittechy merged 1 commit into
mainfrom
68-test-pragma
Aug 11, 2026
Merged

Fail tests that omit the # do not pre-load pragma#75
nonprofittechy merged 1 commit into
mainfrom
68-test-pragma

Conversation

@nonprofittechy

Copy link
Copy Markdown
Member

When Docassemble encounters a Python module, it will eagerly load it into memory. This can cause problems and slow-downs when this happens to a test file, especially when the test file loads dev-only dependencies or mocks a docassemble internal. It can cause unnecessary namespace collisions for other imported modules, too.

LLMs tend to add a lot of tests, and it can sometimes miss this (I've found many will handle it fine if there are enough existing tests with this pattern, but that's not reliable).

Best to just avoid this! This adds a test for this scenario.

Fix #68

@nonprofittechy
nonprofittechy merged commit 1f6e849 into main Aug 11, 2026
4 checks passed
@nonprofittechy
nonprofittechy deleted the 68-test-pragma branch August 11, 2026 17:43
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.

Raise error when test module (starting with test_) is missing a # do not pre-load pragma

1 participant