# AssertionError: Expected 'mock_method' to be called once. Called 2 times.

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

## Root Cause

The mock was not reset between tests, so calls from a previous test are still recorded. This often happens when using a module-level mock.

## Version Compatibility

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

## Workarounds

1. **** (98% success)
   ```
   def test_foo(mocker):
    mock = mocker.patch('module.func')
    # mocker automatically resets after test
   ```
2. **** (95% success)
   ```
   @pytest.fixture
def mock_func():
    with patch('module.func') as m:
        yield m
   ```

## Dead Ends

- **** — This works but is error-prone and must be remembered for every test. (60% fail)
- **** — If the mock is patching a module, it must be created in a fixture. (70% fail)
