Skip to content

Tests fail with 1.11.2 #169

@chbndrhnns

Description

@chbndrhnns

After upgrading to 1.11.2, my tests using pytest-mock start failing with the message below. It turns out this change fixes it but it still needs to be released.

I am using pytest 5.2.4

self = <pytest_mock.plugin.MockFixture._Patcher object at 0x104e8c590>
stack = [FrameInfo(frame=<frame at 0x104cfc5c0, file '/Users/powerjo/.local/share/virtualenvs/backend-qQJPOvQO/lib/python3.7/s...92, function='_hookexec', code_context=['        return self._inner_hookexec(hook, methods, kwargs)\n'], index=0), ...]

    def _enforce_no_with_context(self, stack):
        """raises a ValueError if mocker is used in a with context"""
        caller = stack[1]
        frame = caller[0]
        info = inspect.getframeinfo(frame)
>       code_context = " ".join(info.code_context).strip()
E       TypeError: can only join an iterable

../../../../.local/share/virtualenvs/backend-qQJPOvQO/lib/python3.7/site-packages/pytest_mock/plugin.py:167: TypeError

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