Q112 [Scenario]: A Python team using PyTest highlights a function and runs /tests in Copilot Chat, but Copilot generates unittest class boilerplate instead. Why did this happen and how do they fix it?

Copilot lacked context regarding the team's testing framework preference. To fix this, keep an existing test_*.py PyTest file open in an active tab, or specify framework: pytest explicitly in the prompt or .github/copilot-instructions.md file.

Key Takeaways
  • Open neighboring files act as strong context indicators.

  • Explicitly state testing frameworks in prompts or repo instruction files.

Knowledge Check

How can the developer guide Copilot to generate PyTest syntax instead of unittest?