Skip to content

mock.patch.object type annotation fails with **kwargs #7542

Open
@graingert

Description

@graingert

https://mypy-play.net/?mypy=latest&python=3.10&gist=6f7d6d1036646b8e8a41ed3a5dab3b98&flags=strict

from unittest import mock
import subprocess


def foo() -> None:
    with mock.patch.object(
        subprocess,
        "Popen",
        **{"return_value.communicate.side_effect": KeyboardInterrupt}
    ):
        pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions