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

Method test_mock_sorting

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

Source from the content-addressed store, hash-verified

251 assert funcnames == ["T.test_hello", "test_someting"]
252
253 def test_mock_sorting(self, pytester: Pytester) -> None:
254 pytest.importorskip("mock", "1.0.1")
255 pytester.makepyfile(
256 """
257 import os
258 import mock
259
260 @mock.patch("os.path.abspath")
261 def test_one(abspath):
262 pass
263 @mock.patch("os.path.abspath")
264 def test_two(abspath):
265 pass
266 @mock.patch("os.path.abspath")
267 def test_three(abspath):
268 pass
269 """
270 )
271 reprec = pytester.inline_run()
272 calls = reprec.getreports("pytest_runtest_logreport")
273 calls = [x for x in calls if x.when == "call"]
274 names = [x.nodeid.split("::")[-1] for x in calls]
275 assert names == ["test_one", "test_two", "test_three"]
276
277 def test_mock_double_patch_issue473(self, pytester: Pytester) -> None:
278 pytest.importorskip("mock", "1.0.1")

Callers

nothing calls this directly

Calls 3

makepyfileMethod · 0.45
inline_runMethod · 0.45
getreportsMethod · 0.45

Tested by

no test coverage detected