MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_callables_nocode

Method test_callables_nocode

testing/python/fixtures.py:1870–1885  ·  view source on GitHub ↗

An imported mock.call would break setup/factory discovery due to it being callable and __code__ not being a code object.

(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

1868 reprec.assertoutcome(passed=2)
1869
1870 def test_callables_nocode(self, pytester: Pytester) -> None:
1871 """An imported mock.call would break setup/factory discovery due to
1872 it being callable and __code__ not being a code object."""
1873 pytester.makepyfile(
1874 """
1875 class _call(tuple):
1876 def __call__(self, *k, **kw):
1877 pass
1878 def __getattr__(self, k):
1879 return self
1880
1881 call = _call()
1882 """
1883 )
1884 reprec = pytester.inline_run("-s")
1885 reprec.assertoutcome(failed=0, passed=0)
1886
1887 def test_autouse_in_conftests(self, pytester: Pytester) -> None:
1888 a = pytester.mkdir("a")

Callers

nothing calls this directly

Calls 3

assertoutcomeMethod · 0.80
makepyfileMethod · 0.45
inline_runMethod · 0.45

Tested by

no test coverage detected