A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pytest-dev/pytest/issues/3288 below:

monkeypatch'ing functools.partial causes INTERNALERROR · Issue #3288 · pytest-dev/pytest · GitHub

Hi,

I've got this test

import functools
from unittest.mock import Mock


def test_partial(monkeypatch):
    monkeypatch.setattr(functools, "partial", Mock())
    assert functools.partial.call_count == 1

Running pytest on a clean environment produces:

INTERNALERROR>     if isinstance(obj, functools.partial):
INTERNALERROR> TypeError: isinstance() arg 2 must be a type or tuple of types

I'm not sure if this kind of patching is supported.
Note that the error only happens if the assert causes the test to fail, otherwise everything works.

I'm using version 3.4.2

pip list:

attrs (17.4.0)
pip (9.0.1)
pkg-resources (0.0.0)
pluggy (0.6.0)
py (1.5.2)
pytest (3.4.2)
setuptools (38.5.2)
six (1.11.0)
wheel (0.30.0)

OS: Ubuntu 16.04.4 LTS


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4