Skip to content

Conversation

@policyengine
Copy link
Contributor

@policyengine policyengine bot commented Dec 9, 2025

Summary

Implements the "quick wins" from issue #1452 to address slow test execution and high memory usage:

  • ✅ Dropped validity tests
  • ✅ Converted module-level baseline to pytest fixture
  • ✅ Added pytest markers to separate fast/slow tests

Changes

  1. Removed test_validity.py - This test loaded the full 100MB+ FRS dataset and tested all ~698 variables, consuming significant time and memory
  2. Added pytest marker configuration - New microsimulation marker in pyproject.toml for memory-intensive tests
  3. Converted baseline to fixture - Changed test_reform_impacts.py from module-level baseline = Microsimulation() to @pytest.fixture(scope="module") to avoid loading on import
  4. Added markers to all microsim tests - Tagged all tests in test_reform_impacts.py and test_salary_sacrifice_cap_reform.py with @pytest.mark.microsimulation
  5. Updated Makefile:
    • make test - Now skips microsimulation tests by default (fast)
    • make test-all - Runs all tests including microsimulation (complete)
    • make test-microsimulation - Runs only microsimulation tests

Benefits

  • Faster default tests: make test runs in seconds instead of minutes
  • Lower memory usage: No validity tests iterating through 698 variables
  • Better resource efficiency: Baseline fixture shared across all reform tests
  • Flexible testing: Developers can choose fast vs comprehensive tests

Impact

  • Regular development: Fast feedback with make test
  • CI/CD: Can configure to run make test-all nightly
  • Memory: Should stay well under 4GB limit for regular test runs

Closes #1452

🤖 Generated with Claude Code

…ion markers

This commit implements the "quick wins" to address slow test execution and high memory usage.

Changes:
- Removed test_validity.py which tested all ~698 variables with full microsimulation
- Added pytest marker `microsimulation` for memory-intensive tests
- Converted baseline in test_reform_impacts.py from module-level variable to pytest fixture
- Updated Makefile to skip microsimulation tests by default with `make test`
- Added `make test-all` to run all tests including microsimulation
- Added `make test-microsimulation` to run only microsimulation tests

Benefits:
- Default `make test` now skips heavy microsimulation tests
- Baseline microsimulation shared across reform tests instead of loading on module import
- Removes validity test that loaded full dataset for every variable
- Tests are now faster and use less memory for regular development

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

Co-Authored-By: Claude <noreply@anthropic.com>
@nikhilwoodruff nikhilwoodruff merged commit 5b488b6 into master Dec 10, 2025
2 checks passed
@nikhilwoodruff nikhilwoodruff deleted the bot/issue-1452 branch December 10, 2025 08:41
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.

Examine why tests take so long and use so much memory

3 participants