Skip to content

Conversation

@jiaminc-cmu
Copy link
Collaborator

close #97
Add --unit-test flag for pdd generate.
This PR introduces a --unit-test flag for the pdd generate command to allow including the corresponding test file in the generation context.

  • Added --unit-test option to pdd generate

  • Updated generation logic to load the associated test file into the context when the flag is set

  • Appended a new test case to cover this behavior

@gltanaka gltanaka requested a review from Copilot November 27, 2025 01:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for including unit test files in the generation context when using the pdd generate command. The --unit-test flag allows users to provide a test file path, which is then appended to the prompt content sent to the LLM to help generate code that passes the specified tests.

Key Changes:

  • Added a --unit-test CLI option to the generate command
  • Modified code_generator_main to read and append unit test content to the prompt when the flag is set
  • Added test coverage for the new functionality

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
pdd/cli.py Added --unit-test option and parameter to the generate command
pdd/code_generator_main.py Implemented logic to read and append unit test content to the prompt with proper formatting
tests/test_code_generator_main.py Added test case to verify unit test content is correctly included in the prompt

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gltanaka
Copy link
Contributor

Nice work! Although the issue initially made this optional, I think it is better to have this as the default with the option to exclude the tests.

Also, I think rather than have to find the unit test file, it would be better to automatically use the default naming conventions to find and include the unit tests esp. if the tests are split among multiple tests files.

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.

include in tests into the context window when generating

2 participants