Skip to content

v0.6.0#7

Merged
HH-MWB merged 3 commits intomainfrom
fix/v0.6.0
Mar 10, 2026
Merged

v0.6.0#7
HH-MWB merged 3 commits intomainfrom
fix/v0.6.0

Conversation

@HH-MWB
Copy link
Copy Markdown
Owner

@HH-MWB HH-MWB commented Mar 10, 2026

Description

Pre-release fixes for v0.6.0: correct callback order in Timer.__enter__, make the CPU-bound block scenario stable, and simplify the BDD step layout (remove utils.py, centralize shared steps).

Summary of Change

1. Library: invoke on_start before recording timestamps (timerun.py)

  • In Timer.__enter__, on_start(measurement) is now invoked before recording perf_counter_ns() and process_time_ns().
  • Ensures the measured interval does not include callback work and reflects the intended start of timing.

2. Tests: fix flaky CPU-bound scenario

  • Scenario: Renamed from "yields wall and CPU time close together" to "yields meaningful wall and CPU time."
  • Assertion: Removed the "CPU time is close to wall time" step that failed under load when the process was scheduled out (wall > CPU by more than the buffer). The scenario now only asserts wall time ≥ 10,000,000 ns and CPU time within the configured buffer of 10,000,000 ns.
  • Step: New step "the measurement's wall time duration is at least X nanoseconds" in block_timing_steps.py for this case; other scenarios still use the shared "within buffer" step from common_steps.py.
  • CPU-bound step: The "measure operation using with" step now uses a process-time spin (process_time_ns()) for CPU-bound operations instead of the old wall-time spin from utils.py, so the scenario actually exercises CPU time.

3. Test structure and docs

  • Removed features/steps/utils.py: Inlined or moved helpers into common_steps.py. BUFFER_NS and the "within buffer" / "which measurement" logic live in common_steps.py; sleep/spin in step files use time.sleep / time.process_time_ns() directly.
  • common_steps.py: Clarified as "steps shared by more than one feature." Added _measurement(context, which) and parameterized steps so one implementation supports "the measurement's…" and "the first/second/outer/inner measurement's…" (wall time within buffer, metadata key). Minor comment and structure cleanup; CPU lower slack inlined as 1_000_000 ns.
  • block_timing_steps.py: Uses common_steps for shared steps; only block-specific steps and the new "at least" wall step remain here. Sleep/spin via time only.
  • function_timing_steps.py: Replaced sleep_wall_at_least with time.sleep(...); no dependency on utils.py. Light comment/formatting cleanup.
  • measurement_steps.py: Empty-metadata assertion simplified to assert context.measurement.metadata == {}.
  • CONTRIBUTING.md: Prerequisites list now includes pip and Make; clone URL uses YOUR_USERNAME; feature layout description updated (no utils.py; shared steps in common_steps.py).
  • docs/recipes/analyze-results.md: Wording updated to "wrapped callable's measurements" for clarity.

Checklist

  • I have run make lint test and both pass
  • I have updated the documentation accordingly (if applicable)

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (cb6c5c9) to head (e08ef17).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main        #7   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines          107       107           
=========================================
  Hits           107       107           
Flag Coverage Δ
python3.10 100.00% <100.00%> (ø)
python3.11 100.00% <100.00%> (ø)
python3.12 100.00% <100.00%> (ø)
python3.13 100.00% <100.00%> (ø)
python3.14 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.

@HH-MWB HH-MWB marked this pull request as ready for review March 10, 2026 02:14
@HH-MWB HH-MWB merged commit dc4de99 into main Mar 10, 2026
9 checks passed
@HH-MWB HH-MWB deleted the fix/v0.6.0 branch March 10, 2026 02:47
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