Skip to content

Conversation

@policyengine
Copy link
Contributor

@policyengine policyengine bot commented Dec 9, 2025

Summary

Adds comprehensive documentation on optimizing test suite performance in PolicyEngine country model repositories.

Changes

  • New Section 11 in policyengine-testing-patterns-skill: "Test Suite Performance Optimization"
  • Documents pytest markers pattern for separating fast and slow tests
  • Explains fixture optimization to avoid module-level initialization
  • Identifies expensive test patterns to avoid (validity tests)
  • Provides standard Makefile targets pattern

Context

This guidance was learned from optimizing policyengine-uk (issue #1452), where these patterns:

  • Reduced test time from minutes to seconds
  • Reduced memory usage from >4GB to <1GB
  • Fixed CI failures due to OOM errors
  • Improved developer feedback loop

Impact

Future Claude Code sessions working on country model repositories will now:

  • Know to use @pytest.mark.microsimulation for expensive tests
  • Understand how to optimize test fixtures
  • Recognize and remove performance-killing patterns
  • Provide appropriate make test targets for repos

🤖 Generated with Claude Code

Adds section 11 to policyengine-testing-patterns-skill documenting best practices for optimizing test suite performance in country model repositories.

Key patterns:
- Use @pytest.mark.microsimulation for expensive tests
- Separate fast unit tests from slow microsimulation tests
- Provide make test/test-all/test-microsimulation targets
- Use module-scoped fixtures instead of module-level initialization
- Remove expensive validity tests that iterate all variables

Learned from policyengine-uk issue #1452 where these optimizations reduced:
- Test time from minutes to seconds
- Memory usage from >4GB to <1GB
- CI failures due to OOM errors

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
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.

2 participants