Skip to content

fix(ci): Reset mock calls#6288

Open
saurabh6790 wants to merge 1 commit into
frappe:masterfrom
saurabh6790:fix-test
Open

fix(ci): Reset mock calls#6288
saurabh6790 wants to merge 1 commit into
frappe:masterfrom
saurabh6790:fix-test

Conversation

@saurabh6790

Copy link
Copy Markdown
Member

No description provided.

@saurabh6790 saurabh6790 requested a review from ssiyad as a code owner April 28, 2026 17:36
@mergify

mergify Bot commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

@saurabh6790, thanks for the contribution, but we do not accept pull requests on a master. Please close this PR and raise PR on an develop branch.

@greptile-apps

greptile-apps Bot commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a mock_calls_create.reset_mock() call in test_no_calls_before_investigator_actions before the second resolve_incidents() invocation. Without the reset, the assert_not_called() on line 505 was checking cumulative call state from the start of the test — which happened to pass only because the first resolve_incidents() call also made no calls. The reset makes the assertion explicitly scoped to the second call only, improving test precision and clarity.

Confidence Score: 5/5

Safe to merge — small, focused test fix with no production code changes.

Single-line addition to a test file, no logic changes, no P0/P1 findings. The fix is correct and improves test precision.

No files require special attention.

Important Files Changed

Filename Overview
press/press/doctype/incident/test_incident.py Single-line fix adds mock_calls_create.reset_mock() before the second resolve_incidents() call in test_no_calls_before_investigator_actions to scope the subsequent assert_not_called() check to only the calls made after that point.

Sequence Diagram

sequenceDiagram
    participant Test as test_no_calls_before_investigator_actions
    participant RI as resolve_incidents()
    participant Mock as mock_calls_create

    Test->>RI: call (status=Acknowledged, interval not elapsed)
    RI-->>Mock: (no call made)
    Test->>Mock: assert_not_called() ✓

    Note over Test: db_set modified time back (interval now elapsed)
    Test->>Mock: reset_mock() ← NEW: scope assertion to this point
    Test->>RI: call (interval elapsed, investigator not Completed)
    RI-->>Mock: (no call made — investigator not done)
    Test->>Mock: assert_not_called() ✓

    Test->>Test: investigator.db_set("status", "Completed")
    Test->>RI: call (investigator Completed)
    RI->>Mock: create(...)
    Test->>Mock: assert_called_once() ✓
Loading

Reviews (1): Last reviewed commit: "fix(ci): Reset mock calls" | Re-trigger Greptile

@codecov

codecov Bot commented Apr 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 55.91%. Comparing base (ceaa680) to head (dcad434).
⚠️ Report is 387 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #6288       +/-   ##
===========================================
+ Coverage        0   55.91%   +55.91%     
===========================================
  Files           0      910      +910     
  Lines           0    75619    +75619     
  Branches        0      522      +522     
===========================================
+ Hits            0    42282    +42282     
- Misses          0    33309    +33309     
- Partials        0       28       +28     
Flag Coverage Δ
dashboard 90.78% <ø> (?)

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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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