# AssertionError: expected call not found.
Expected: send(1)
  Actual: not called.

- **ID:** `python/pytest-mock-mocker-scope-mismatch`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

mocker.patch was applied inside a fixture with function scope, but the patched call happens in a session-scoped setup that ran before the patch was installed.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.14.x | active | — | — |

## Workarounds

1. **** (90% success)
   ```
   @pytest.fixture(scope='session')
def patched_send():
    with mock.patch('myapp.notify.send') as m:
        yield m

def test_x(patched_send):
    run_setup()
    patched_send.assert_called_with(1)
   ```
2. **** (93% success)
   ```
   def test_x(mocker):
    m = mocker.patch('myapp.notify.send')
    run_setup()  # called here, not in a fixture
    m.assert_called_with(1)
   ```

## Dead Ends

- **** — The mock was never called in the first place; resetting does not retroactively capture calls that happened before patching. (90% fail)
- **** — create=True only bypasses AttributeError; the timing problem (patch applied after the call) is unchanged. (85% fail)
