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

Method test_unittest_mock

testing/python/integration.py:133–146  ·  view source on GitHub ↗
(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

131 assert values == ("y", "z")
132
133 def test_unittest_mock(self, pytester: Pytester) -> None:
134 pytester.makepyfile(
135 """
136 import unittest.mock
137 class T(unittest.TestCase):
138 @unittest.mock.patch("os.path.abspath")
139 def test_hello(self, abspath):
140 import os
141 os.path.abspath("hello")
142 abspath.assert_any_call("hello")
143 """
144 )
145 reprec = pytester.inline_run()
146 reprec.assertoutcome(passed=1)
147
148 def test_unittest_mock_and_fixture(self, pytester: Pytester) -> None:
149 pytester.makepyfile(

Callers

nothing calls this directly

Calls 3

assertoutcomeMethod · 0.80
makepyfileMethod · 0.45
inline_runMethod · 0.45

Tested by

no test coverage detected