Skip to content

Add unit tests for functional/platforms/agent_stopper utils (real coverage)#687

Open
wbarnha wants to merge 2 commits into
masterfrom
claude/test-quick-wins
Open

Add unit tests for functional/platforms/agent_stopper utils (real coverage)#687
wbarnha wants to merge 2 commits into
masterfrom
claude/test-quick-wins

Conversation

@wbarnha

@wbarnha wbarnha commented Jul 17, 2026

Copy link
Copy Markdown
Member

Description

Coverage "quick wins" — convert three gaps into genuine tests rather than leaving them excluded from coverage. Each target goes to 100%:

Module Before Change
faust/utils/functional.py 75% (only consecutive_numbers tested) Add a translate() test (incl. multi-char patterns and empty table) → 100%; remove its .coveragerc omit
faust/utils/platforms.py 0% (omitted) Test max_open_files() across all branches — normal hard limit, RLIM_INFINITY on non-Darwin, RLIM_INFINITY on Darwin (via sysctl), and missing resource module → 100%; remove its .coveragerc omit
faust/utils/agent_stopper.py 0% (measured, untested) Test that agent_stopper() crashes the app with RuntimeError100%

So functional.py and platforms.py come off the .coveragerc omit list — their coverage is now real and enforced going forward, not hidden.

Notes

  • The platforms tests use stacked @patch decorators instead of a parenthesized multi-context with (...): black (unpinned/26.x, no target-version) would rewrite the latter to 3.10+ syntax, which would break the Python 3.9 matrix job. The decorator form stays valid on 3.9 and is black-stable.
  • Lint clean (flake8 / isort / black); 13 tests, all passing.

This is the first batch; further un-omissions (e.g. windows.py, assignor/*, the CLI) are natural follow-ups.


Generated by Claude Code

Convert three coverage gaps into genuine tests instead of leaving them
excluded:

- utils/functional.py: add a test for translate() (only consecutive_numbers
  was covered -> 75%); now 100%. Remove its .coveragerc omit.
- utils/platforms.py: test max_open_files() across all branches (normal
  hard limit, RLIM_INFINITY on non-Darwin, RLIM_INFINITY on Darwin via
  sysctl, and missing 'resource' module); now 100%. Remove its omit.
- utils/agent_stopper.py: test that agent_stopper() crashes the app with a
  RuntimeError; 0% -> 100% (was measured but untested).

platforms tests use stacked @patch decorators rather than a parenthesized
multi-context 'with' so the file stays valid on Python 3.9.
@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.14%. Comparing base (11834d8) to head (0423868).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #687      +/-   ##
==========================================
+ Coverage   94.06%   94.14%   +0.07%     
==========================================
  Files         102      104       +2     
  Lines       11108    11136      +28     
  Branches     1198     1201       +3     
==========================================
+ Hits        10449    10484      +35     
+ Misses        558      551       -7     
  Partials      101      101              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant