Skip to content

pytest introspection with assert_called_once_with() #154

@The-Compiler

Description

@The-Compiler

When a mock is called multiple times (with the right arguments, at some point) but only one call is expected:

def test_foo(mocker): mock = mocker.Mock() mock('foo') mock('test') mock.assert_called_once_with('test')

the output is:

> mock.assert_called_once_with('test') E AssertionError: Expected 'mock' to be called once. Called 2 times. E E pytest introspection follows: test_x.py:5: AssertionError 

which is kind of confusing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions