Add failing tests for #412: incorrect sys.modules paths#434
Draft
prompt-driven-github[bot] wants to merge 1 commit intomainfrom
Draft
Add failing tests for #412: incorrect sys.modules paths#434prompt-driven-github[bot] wants to merge 1 commit intomainfrom
prompt-driven-github[bot] wants to merge 1 commit intomainfrom
Conversation
This commit adds two comprehensive test files that detect the bug where PDD generates tests with incorrect sys.modules paths that don't match actual import statements in source code. Test files: - tests/test_e2e_issue_412_sys_modules_paths.py: Unit tests validating that generated sys.modules keys match actual import paths - tests/test_e2e_issue_412_cli_sys_modules_paths.py: E2E tests exercising the full PDD CLI workflow with realistic project structures All tests fail as expected, successfully reproducing the bug reported in #412. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This was referenced Jan 29, 2026
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.
Summary
Adds failing tests that detect the bug reported in #412, where PDD generates tests with incorrect
sys.modulespaths that don't match actual import statements in source code.Test Files
tests/test_e2e_issue_412_sys_modules_paths.pytests/test_e2e_issue_412_cli_sys_modules_paths.pyWhat This PR Contains
sys.moduleskeys match actual import paths from source codeRoot Cause
PDD does not extract actual import statements from source code before generating tests. It only passes the filename stem (e.g., "firestore_client") as
module_nameto the LLM atpdd/cmd_test_main.py:193, forcing the LLM to guess which module paths need mocking insys.modules. This results in inconsistent inference where sometimessys.modules["config"]is generated (wrong) when the source usesfrom src.config import ..., and sometimessys.modules["src.config"]is generated (correct).Next Steps
pdd/cmd_test_main.pyto extract actual import paths using Python'sastmoduleFixes #412
Generated by PDD agentic bug workflow