# AssertionError: Expected 'send_email' to be called once. Called 0 times.

- **ID:** `python/pytest-mock-reset-between-calls`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The test asserts `mock.assert_called_once()` but the mock was reset (e.g. by `mock.reset_mock()` or a fixture that resets it) before the assertion, or the code under test was patched at the wrong target.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.10 | active | — | — |
| 3.12 | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   Patch where the name is looked up and verify the patch target:

@patch('app.services.user.send_email')
def test_signup(mock_send):
    signup()
    mock_send.assert_called_once()
   ```
2. **** (90% success)
   ```
   Remove any `reset_mock()` calls between the action and the assertion, or use `mock.call_count` to inspect at the exact point.
   ```

## Dead Ends

- **** — Still fails if the mock was never called; masks the real issue. (70% fail)
- **** — Repeating the assertion does not change the call count. (95% fail)
