1START: ptest-runner
22023-10-13T17:54
3BEGIN: /usr/lib/python3-pytest-mock/ptest
4============================= test session starts ==============================
5platform linux -- Python 3.11.5, pytest-7.4.2, pluggy-1.3.0
6rootdir: /usr/lib/python3-pytest-mock/ptest
7plugins: mock-3.11.2.dev0+gd3e73f2.d20230615
8collected 83 items
9
10PASS: tests/test_pytest_mock.py::test_mock_patches[mock_using_patch_object]
11PASS: tests/test_pytest_mock.py::test_mock_patches[mock_using_patch]
12PASS: tests/test_pytest_mock.py::test_mock_patches[mock_using_patch_multiple]
13PASS: tests/test_pytest_mock.py::test_mock_patch_dict
14PASS: tests/test_pytest_mock.py::test_mock_patch_dict_resetall
15PASS: tests/test_pytest_mock.py::test_mocker_aliases[ANY]
16PASS: tests/test_pytest_mock.py::test_mocker_aliases[call]
17PASS: tests/test_pytest_mock.py::test_mocker_aliases[create_autospec]
18PASS: tests/test_pytest_mock.py::test_mocker_aliases[MagicMock]
19PASS: tests/test_pytest_mock.py::test_mocker_aliases[Mock]
20PASS: tests/test_pytest_mock.py::test_mocker_aliases[mock_open]
21PASS: tests/test_pytest_mock.py::test_mocker_aliases[NonCallableMagicMock]
22PASS: tests/test_pytest_mock.py::test_mocker_aliases[NonCallableMock]
23PASS: tests/test_pytest_mock.py::test_mocker_aliases[PropertyMock]
24PASS: tests/test_pytest_mock.py::test_mocker_aliases[sentinel]
25PASS: tests/test_pytest_mock.py::test_mocker_aliases[seal]
26PASS: tests/test_pytest_mock.py::test_mocker_resetall
27PASS: tests/test_pytest_mock.py::TestMockerStub::test_call
28PASS: tests/test_pytest_mock.py::TestMockerStub::test_repr_with_no_name
29PASS: tests/test_pytest_mock.py::TestMockerStub::test_repr_with_name
30PASS: tests/test_pytest_mock.py::TestMockerStub::test_failure_message_with_no_name
31PASS: tests/test_pytest_mock.py::TestMockerStub::test_failure_message_with_name[None]
32PASS: tests/test_pytest_mock.py::TestMockerStub::test_failure_message_with_name[]
33PASS: tests/test_pytest_mock.py::TestMockerStub::test_failure_message_with_name[f]
34PASS: tests/test_pytest_mock.py::TestMockerStub::test_failure_message_with_name[The Castle of aaarrrrggh]
35PASS: tests/test_pytest_mock.py::TestMockerStub::test_async_stub_type
36PASS: tests/test_pytest_mock.py::test_instance_method_spy
37PASS: tests/test_pytest_mock.py::test_instance_method_spy_exception[BaseException]
38PASS: tests/test_pytest_mock.py::test_instance_method_spy_exception[Exception]
39PASS: tests/test_pytest_mock.py::test_instance_method_spy_exception[GeneratorExit]
40PASS: tests/test_pytest_mock.py::test_instance_method_spy_exception[KeyboardInterrupt]
41PASS: tests/test_pytest_mock.py::test_instance_method_spy_exception[RuntimeError]
42PASS: tests/test_pytest_mock.py::test_instance_method_spy_exception[SystemExit]
43PASS: tests/test_pytest_mock.py::test_instance_method_spy_autospec_true
44PASS: tests/test_pytest_mock.py::test_spy_reset
45PASS: tests/test_pytest_mock.py::test_instance_method_by_class_spy
46PASS: tests/test_pytest_mock.py::test_instance_method_by_subclass_spy
47PASS: tests/test_pytest_mock.py::test_class_method_spy
48PASS: tests/test_pytest_mock.py::test_class_method_spy_autospec_false
49PASS: tests/test_pytest_mock.py::test_class_method_subclass_spy
50PASS: tests/test_pytest_mock.py::test_class_method_with_metaclass_spy
51PASS: tests/test_pytest_mock.py::test_static_method_spy
52PASS: tests/test_pytest_mock.py::test_static_method_subclass_spy
53PASS: tests/test_pytest_mock.py::test_callable_like_spy
54tests/test_pytest_mock.py::test_instance_async_method_spy SKIP (a...)
55PASS: tests/test_pytest_mock.py::test_assert_not_called_wrapper
56PASS: tests/test_pytest_mock.py::test_assert_called_with_wrapper
57PASS: tests/test_pytest_mock.py::test_assert_called_once_with_wrapper
58PASS: tests/test_pytest_mock.py::test_assert_called_once_wrapper
59PASS: tests/test_pytest_mock.py::test_assert_called_wrapper
60SKIP: tests/test_pytest_mock.py::test_assert_called_args_with_introspection
61SKIP: tests/test_pytest_mock.py::test_assert_called_kwargs_with_introspection
62PASS: tests/test_pytest_mock.py::test_assert_any_call_wrapper
63PASS: tests/test_pytest_mock.py::test_assert_has_calls
64PASS: tests/test_pytest_mock.py::test_assert_has_calls_multiple_calls
65PASS: tests/test_pytest_mock.py::test_assert_has_calls_multiple_calls_subset
66PASS: tests/test_pytest_mock.py::test_assert_has_calls_multiple_calls_any_order
67PASS: tests/test_pytest_mock.py::test_assert_has_calls_multiple_calls_any_order_subset
68PASS: tests/test_pytest_mock.py::test_assert_has_calls_no_calls
69PASS: tests/test_pytest_mock.py::test_monkeypatch_ini
70PASS: tests/test_pytest_mock.py::test_parse_ini_boolean
71PASS: tests/test_pytest_mock.py::test_patched_method_parameter_name
72PASS: tests/test_pytest_mock.py::test_monkeypatch_native
73PASS: tests/test_pytest_mock.py::test_monkeypatch_no_terminal
74tests/test_pytest_mock.py::test_standalone_mock SKIP (could not i...)
75PASS: tests/test_pytest_mock.py::test_detailed_introspection
76FAIL: tests/test_pytest_mock.py::test_detailed_introspection_async
77PASS: tests/test_pytest_mock.py::test_missing_introspection
78PASS: tests/test_pytest_mock.py::test_assert_called_with_unicode_arguments
79FAIL: tests/test_pytest_mock.py::test_plain_stopall
80PASS: tests/test_pytest_mock.py::test_warn_patch_object_context_manager
81PASS: tests/test_pytest_mock.py::test_warn_patch_context_manager
82PASS: tests/test_pytest_mock.py::test_context_manager_patch_example
83PASS: tests/test_pytest_mock.py::test_patch_context_manager_with_context_manager
84PASS: tests/test_pytest_mock.py::test_abort_patch_context_manager_with_stale_pyc
85FAIL: tests/test_pytest_mock.py::test_used_with_class_scope
86FAIL: tests/test_pytest_mock.py::test_used_with_module_scope
87FAIL: tests/test_pytest_mock.py::test_used_with_package_scope
88FAIL: tests/test_pytest_mock.py::test_used_with_session_scope
89PASS: tests/test_pytest_mock.py::test_stop_patch
90PASS: tests/test_pytest_mock.py::test_stop_instance_patch
91PASS: tests/test_pytest_mock.py::test_stop_spy
92PASS: tests/test_pytest_mock.py::test_stop_instance_spy
93
94=================================== FAILURES ===================================
95______________________ test_detailed_introspection_async _______________________
96
97testdir = <Testdir local('/tmp/pytest-of-unknown/pytest-0/test_detailed_introspection_async0')>
98
99 @pytest.mark.skipif(
100 sys.version_info < (3, 8), reason="AsyncMock is present on 3.8 and above"
101 )
102 @pytest.mark.usefixtures("needs_assert_rewrite")
103 def test_detailed_introspection_async(testdir: Any) -> None:
104 """Check that the "mock_use_standalone" is being used."""
105 testdir.makeini(
106 """
107 [pytest]
108 asyncio_mode=auto
109 """
110 )
111 testdir.makepyfile(
112 """
113 import pytest
114
115 async def test(mocker):
116 m = mocker.AsyncMock()
117 await m('fo')
118 m.assert_awaited_once_with('', bar=4)
119 """
120 )
121 result = testdir.runpytest("-s")
122 expected_lines = [
123 "*AssertionError: expected await not found.",
124 "*Expected: mock('', bar=4)",
125 "*Actual: mock('fo')",
126 "*pytest introspection follows:*",
127 "*Args:",
128 "*assert ('fo',) == ('',)",
129 "*At index 0 diff: 'fo' != ''*",
130 "*Use -v to get more diff*",
131 "*Kwargs:*",
132 "*assert {} == {'bar': 4}*",
133 "*Right contains* more item*",
134 "*{'bar': 4}*",
135 "*Use -v to get more diff*",
136 ]
137> result.stdout.fnmatch_lines(expected_lines)
138E Failed: nomatch: '*AssertionError: expected await not found.'
139E and: '============================= test session starts =============================='
140E and: 'platform linux -- Python 3.11.5, pytest-7.4.2, pluggy-1.3.0'
141E and: 'rootdir: /tmp/pytest-of-unknown/pytest-0/test_detailed_introspection_async0'
142E and: 'configfile: tox.ini'
143E and: 'plugins: mock-3.11.2.dev0+gd3e73f2.d20230615'
144E and: 'collected 1 item'
145E and: ''
146E and: 'test_detailed_introspection_async.py s'
147E and: ''
148E and: '=============================== warnings summary ==============================='
149E and: '../../../../usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373'
150E and: ' /usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373: PytestConfigWarning: Unknown config option: asyncio_mode'
151E and: ' '
152E and: ' self._warn_or_fail_if_strict(f"Unknown config option: {key}\\n")'
153E and: ''
154E and: 'test_detailed_introspection_async.py::test'
155E and: ' /usr/lib/python3.11/site-packages/_pytest/python.py:183: PytestUnhandledCoroutineWarning: async def functions are not natively supported and have been skipped.'
156E and: ' You need to install a suitable plugin for your async framework, for example:'
157E and: ' - anyio'
158E and: ' - pytest-asyncio'
159E and: ' - pytest-tornasync'
160E and: ' - pytest-trio'
161E and: ' - pytest-twisted'
162E and: ' warnings.warn(PytestUnhandledCoroutineWarning(msg.format(nodeid)))'
163E and: ''
164E and: '-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html'
165E and: '======================== 1 skipped, 2 warnings in 0.01s ========================'
166E remains unmatched: '*AssertionError: expected await not found.'
167
168/usr/lib/python3-pytest-mock/ptest/tests/test_pytest_mock.py:904: Failed
169----------------------------- Captured stdout call -----------------------------
170============================= test session starts ==============================
171platform linux -- Python 3.11.5, pytest-7.4.2, pluggy-1.3.0
172rootdir: /tmp/pytest-of-unknown/pytest-0/test_detailed_introspection_async0
173configfile: tox.ini
174plugins: mock-3.11.2.dev0+gd3e73f2.d20230615
175collected 1 item
176
177test_detailed_introspection_async.py s
178
179=============================== warnings summary ===============================
180../../../../usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373
181 /usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373: PytestConfigWarning: Unknown config option: asyncio_mode
182
183 self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
184
185test_detailed_introspection_async.py::test
186 /usr/lib/python3.11/site-packages/_pytest/python.py:183: PytestUnhandledCoroutineWarning: async def functions are not natively supported and have been skipped.
187 You need to install a suitable plugin for your async framework, for example:
188 - anyio
189 - pytest-asyncio
190 - pytest-tornasync
191 - pytest-trio
192 - pytest-twisted
193 warnings.warn(PytestUnhandledCoroutineWarning(msg.format(nodeid)))
194
195-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
196======================== 1 skipped, 2 warnings in 0.01s ========================
197______________________________ test_plain_stopall ______________________________
198
199testdir = <Testdir local('/tmp/pytest-of-unknown/pytest-0/test_plain_stopall0')>
200
201 def test_plain_stopall(testdir: Any) -> None:
202 """patch.stopall() in a test should not cause an error during unconfigure (#137)"""
203 testdir.makeini(
204 """
205 [pytest]
206 asyncio_mode=auto
207 """
208 )
209 testdir.makepyfile(
210 """
211 import random
212
213 def get_random_number():
214 return random.randint(0, 100)
215
216 def test_get_random_number(mocker):
217 patcher = mocker.mock_module.patch("random.randint", lambda x, y: 5)
218 patcher.start()
219 assert get_random_number() == 5
220 mocker.mock_module.patch.stopall()
221 """
222 )
223 result = testdir.runpytest_subprocess()
224> result.stdout.fnmatch_lines("* 1 passed in *")
225E Failed: nomatch: '* 1 passed in *'
226E and: '============================= test session starts =============================='
227E and: 'platform linux -- Python 3.11.5, pytest-7.4.2, pluggy-1.3.0'
228E and: 'rootdir: /tmp/pytest-of-unknown/pytest-0/test_plain_stopall0'
229E and: 'configfile: tox.ini'
230E and: 'plugins: mock-3.11.2.dev0+gd3e73f2.d20230615'
231E and: 'collected 1 item'
232E and: ''
233E and: 'test_plain_stopall.py . '
234E and: ''
235E and: '=============================== warnings summary ==============================='
236E and: '../../../../usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373'
237E and: ' /usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373: PytestConfigWarning: Unknown config option: asyncio_mode'
238E and: ' '
239E and: ' self._warn_or_fail_if_strict(f"Unknown config option: {key}\\n")'
240E and: ''
241E and: '-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html'
242E and: '========================= 1 passed, 1 warning in 0.01s ========================='
243E remains unmatched: '* 1 passed in *'
244
245/usr/lib/python3-pytest-mock/ptest/tests/test_pytest_mock.py:953: Failed
246----------------------------- Captured stdout call -----------------------------
247running: /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-unknown/pytest-0/test_plain_stopall0/runpytest-0
248 in: /tmp/pytest-of-unknown/pytest-0/test_plain_stopall0
249============================= test session starts ==============================
250platform linux -- Python 3.11.5, pytest-7.4.2, pluggy-1.3.0
251rootdir: /tmp/pytest-of-unknown/pytest-0/test_plain_stopall0
252configfile: tox.ini
253plugins: mock-3.11.2.dev0+gd3e73f2.d20230615
254collected 1 item
255
256test_plain_stopall.py .
257
258=============================== warnings summary ===============================
259../../../../usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373
260 /usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373: PytestConfigWarning: Unknown config option: asyncio_mode
261
262 self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
263
264-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
265========================= 1 passed, 1 warning in 0.01s =========================
266__________________________ test_used_with_class_scope __________________________
267
268testdir = <Testdir local('/tmp/pytest-of-unknown/pytest-0/test_used_with_class_scope0')>
269
270 def test_used_with_class_scope(testdir: Any) -> None:
271 testdir.makeini(
272 """
273 [pytest]
274 asyncio_mode=auto
275 """
276 )
277 testdir.makepyfile(
278 """
279 import pytest
280 import random
281 import unittest
282
283 def get_random_number():
284 return random.randint(0, 1)
285
286 @pytest.fixture(autouse=True, scope="class")
287 def randint_mock(class_mocker):
288 return class_mocker.patch("random.randint", lambda x, y: 5)
289
290 class TestGetRandomNumber(unittest.TestCase):
291 def test_get_random_number(self):
292 assert get_random_number() == 5
293 """
294 )
295 result = testdir.runpytest_subprocess()
296 assert "AssertionError" not in result.stderr.str()
297> result.stdout.fnmatch_lines("* 1 passed in *")
298E Failed: nomatch: '* 1 passed in *'
299E and: '============================= test session starts =============================='
300E and: 'platform linux -- Python 3.11.5, pytest-7.4.2, pluggy-1.3.0'
301E and: 'rootdir: /tmp/pytest-of-unknown/pytest-0/test_used_with_class_scope0'
302E and: 'configfile: tox.ini'
303E and: 'plugins: mock-3.11.2.dev0+gd3e73f2.d20230615'
304E and: 'collected 1 item'
305E and: ''
306E and: 'test_used_with_class_scope.py . '
307E and: ''
308E and: '=============================== warnings summary ==============================='
309E and: '../../../../usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373'
310E and: ' /usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373: PytestConfigWarning: Unknown config option: asyncio_mode'
311E and: ' '
312E and: ' self._warn_or_fail_if_strict(f"Unknown config option: {key}\\n")'
313E and: ''
314E and: '-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html'
315E and: '========================= 1 passed, 1 warning in 0.01s ========================='
316E remains unmatched: '* 1 passed in *'
317
318/usr/lib/python3-pytest-mock/ptest/tests/test_pytest_mock.py:1098: Failed
319----------------------------- Captured stdout call -----------------------------
320running: /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-unknown/pytest-0/test_used_with_class_scope0/runpytest-0
321 in: /tmp/pytest-of-unknown/pytest-0/test_used_with_class_scope0
322============================= test session starts ==============================
323platform linux -- Python 3.11.5, pytest-7.4.2, pluggy-1.3.0
324rootdir: /tmp/pytest-of-unknown/pytest-0/test_used_with_class_scope0
325configfile: tox.ini
326plugins: mock-3.11.2.dev0+gd3e73f2.d20230615
327collected 1 item
328
329test_used_with_class_scope.py .
330
331=============================== warnings summary ===============================
332../../../../usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373
333 /usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373: PytestConfigWarning: Unknown config option: asyncio_mode
334
335 self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
336
337-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
338========================= 1 passed, 1 warning in 0.01s =========================
339_________________________ test_used_with_module_scope __________________________
340
341testdir = <Testdir local('/tmp/pytest-of-unknown/pytest-0/test_used_with_module_scope0')>
342
343 def test_used_with_module_scope(testdir: Any) -> None:
344 testdir.makeini(
345 """
346 [pytest]
347 asyncio_mode=auto
348 """
349 )
350 testdir.makepyfile(
351 """
352 import pytest
353 import random
354
355 def get_random_number():
356 return random.randint(0, 1)
357
358 @pytest.fixture(autouse=True, scope="module")
359 def randint_mock(module_mocker):
360 return module_mocker.patch("random.randint", lambda x, y: 5)
361
362 def test_get_random_number():
363 assert get_random_number() == 5
364 """
365 )
366 result = testdir.runpytest_subprocess()
367 assert "AssertionError" not in result.stderr.str()
368> result.stdout.fnmatch_lines("* 1 passed in *")
369E Failed: nomatch: '* 1 passed in *'
370E and: '============================= test session starts =============================='
371E and: 'platform linux -- Python 3.11.5, pytest-7.4.2, pluggy-1.3.0'
372E and: 'rootdir: /tmp/pytest-of-unknown/pytest-0/test_used_with_module_scope0'
373E and: 'configfile: tox.ini'
374E and: 'plugins: mock-3.11.2.dev0+gd3e73f2.d20230615'
375E and: 'collected 1 item'
376E and: ''
377E and: 'test_used_with_module_scope.py . '
378E and: ''
379E and: '=============================== warnings summary ==============================='
380E and: '../../../../usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373'
381E and: ' /usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373: PytestConfigWarning: Unknown config option: asyncio_mode'
382E and: ' '
383E and: ' self._warn_or_fail_if_strict(f"Unknown config option: {key}\\n")'
384E and: ''
385E and: '-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html'
386E and: '========================= 1 passed, 1 warning in 0.02s ========================='
387E remains unmatched: '* 1 passed in *'
388
389/usr/lib/python3-pytest-mock/ptest/tests/test_pytest_mock.py:1126: Failed
390----------------------------- Captured stdout call -----------------------------
391running: /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-unknown/pytest-0/test_used_with_module_scope0/runpytest-0
392 in: /tmp/pytest-of-unknown/pytest-0/test_used_with_module_scope0
393============================= test session starts ==============================
394platform linux -- Python 3.11.5, pytest-7.4.2, pluggy-1.3.0
395rootdir: /tmp/pytest-of-unknown/pytest-0/test_used_with_module_scope0
396configfile: tox.ini
397plugins: mock-3.11.2.dev0+gd3e73f2.d20230615
398collected 1 item
399
400test_used_with_module_scope.py .
401
402=============================== warnings summary ===============================
403../../../../usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373
404 /usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373: PytestConfigWarning: Unknown config option: asyncio_mode
405
406 self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
407
408-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
409========================= 1 passed, 1 warning in 0.02s =========================
410_________________________ test_used_with_package_scope _________________________
411
412testdir = <Testdir local('/tmp/pytest-of-unknown/pytest-0/test_used_with_package_scope0')>
413
414 def test_used_with_package_scope(testdir: Any) -> None:
415 testdir.makeini(
416 """
417 [pytest]
418 asyncio_mode=auto
419 """
420 )
421 testdir.makepyfile(
422 """
423 import pytest
424 import random
425
426 def get_random_number():
427 return random.randint(0, 1)
428
429 @pytest.fixture(autouse=True, scope="package")
430 def randint_mock(package_mocker):
431 return package_mocker.patch("random.randint", lambda x, y: 5)
432
433 def test_get_random_number():
434 assert get_random_number() == 5
435 """
436 )
437 result = testdir.runpytest_subprocess()
438 assert "AssertionError" not in result.stderr.str()
439> result.stdout.fnmatch_lines("* 1 passed in *")
440E Failed: nomatch: '* 1 passed in *'
441E and: '============================= test session starts =============================='
442E and: 'platform linux -- Python 3.11.5, pytest-7.4.2, pluggy-1.3.0'
443E and: 'rootdir: /tmp/pytest-of-unknown/pytest-0/test_used_with_package_scope0'
444E and: 'configfile: tox.ini'
445E and: 'plugins: mock-3.11.2.dev0+gd3e73f2.d20230615'
446E and: 'collected 1 item'
447E and: ''
448E and: 'test_used_with_package_scope.py . '
449E and: ''
450E and: '=============================== warnings summary ==============================='
451E and: '../../../../usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373'
452E and: ' /usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373: PytestConfigWarning: Unknown config option: asyncio_mode'
453E and: ' '
454E and: ' self._warn_or_fail_if_strict(f"Unknown config option: {key}\\n")'
455E and: ''
456E and: '-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html'
457E and: '========================= 1 passed, 1 warning in 0.01s ========================='
458E remains unmatched: '* 1 passed in *'
459
460/usr/lib/python3-pytest-mock/ptest/tests/test_pytest_mock.py:1154: Failed
461----------------------------- Captured stdout call -----------------------------
462running: /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-unknown/pytest-0/test_used_with_package_scope0/runpytest-0
463 in: /tmp/pytest-of-unknown/pytest-0/test_used_with_package_scope0
464============================= test session starts ==============================
465platform linux -- Python 3.11.5, pytest-7.4.2, pluggy-1.3.0
466rootdir: /tmp/pytest-of-unknown/pytest-0/test_used_with_package_scope0
467configfile: tox.ini
468plugins: mock-3.11.2.dev0+gd3e73f2.d20230615
469collected 1 item
470
471test_used_with_package_scope.py .
472
473=============================== warnings summary ===============================
474../../../../usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373
475 /usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373: PytestConfigWarning: Unknown config option: asyncio_mode
476
477 self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
478
479-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
480========================= 1 passed, 1 warning in 0.01s =========================
481_________________________ test_used_with_session_scope _________________________
482
483testdir = <Testdir local('/tmp/pytest-of-unknown/pytest-0/test_used_with_session_scope0')>
484
485 def test_used_with_session_scope(testdir: Any) -> None:
486 testdir.makeini(
487 """
488 [pytest]
489 asyncio_mode=auto
490 """
491 )
492 testdir.makepyfile(
493 """
494 import pytest
495 import random
496
497 def get_random_number():
498 return random.randint(0, 1)
499
500 @pytest.fixture(autouse=True, scope="session")
501 def randint_mock(session_mocker):
502 return session_mocker.patch("random.randint", lambda x, y: 5)
503
504 def test_get_random_number():
505 assert get_random_number() == 5
506 """
507 )
508 result = testdir.runpytest_subprocess()
509 assert "AssertionError" not in result.stderr.str()
510> result.stdout.fnmatch_lines("* 1 passed in *")
511E Failed: nomatch: '* 1 passed in *'
512E and: '============================= test session starts =============================='
513E and: 'platform linux -- Python 3.11.5, pytest-7.4.2, pluggy-1.3.0'
514E and: 'rootdir: /tmp/pytest-of-unknown/pytest-0/test_used_with_session_scope0'
515E and: 'configfile: tox.ini'
516E and: 'plugins: mock-3.11.2.dev0+gd3e73f2.d20230615'
517E and: 'collected 1 item'
518E and: ''
519E and: 'test_used_with_session_scope.py . '
520E and: ''
521E and: '=============================== warnings summary ==============================='
522E and: '../../../../usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373'
523E and: ' /usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373: PytestConfigWarning: Unknown config option: asyncio_mode'
524E and: ' '
525E and: ' self._warn_or_fail_if_strict(f"Unknown config option: {key}\\n")'
526E and: ''
527E and: '-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html'
528E and: '========================= 1 passed, 1 warning in 0.01s ========================='
529E remains unmatched: '* 1 passed in *'
530
531/usr/lib/python3-pytest-mock/ptest/tests/test_pytest_mock.py:1182: Failed
532----------------------------- Captured stdout call -----------------------------
533running: /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-unknown/pytest-0/test_used_with_session_scope0/runpytest-0
534 in: /tmp/pytest-of-unknown/pytest-0/test_used_with_session_scope0
535============================= test session starts ==============================
536platform linux -- Python 3.11.5, pytest-7.4.2, pluggy-1.3.0
537rootdir: /tmp/pytest-of-unknown/pytest-0/test_used_with_session_scope0
538configfile: tox.ini
539plugins: mock-3.11.2.dev0+gd3e73f2.d20230615
540collected 1 item
541
542test_used_with_session_scope.py .
543
544=============================== warnings summary ===============================
545../../../../usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373
546 /usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373: PytestConfigWarning: Unknown config option: asyncio_mode
547
548 self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
549
550-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
551========================= 1 passed, 1 warning in 0.01s =========================
552=============================== warnings summary ===============================
553tests/test_pytest_mock.py::test_instance_async_method_spy
554 /usr/lib/python3.11/site-packages/_pytest/python.py:183: PytestUnhandledCoroutineWarning: async def functions are not natively supported and have been skipped.
555 You need to install a suitable plugin for your async framework, for example:
556 - anyio
557 - pytest-asyncio
558 - pytest-tornasync
559 - pytest-trio
560 - pytest-twisted
561 warnings.warn(PytestUnhandledCoroutineWarning(msg.format(nodeid)))
562
563-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
564=========================== short test summary info ============================
565FAIL tests/test_pytest_mock.py::test_detailed_introspection_async - Failed:...
566FAIL tests/test_pytest_mock.py::test_plain_stopall - Failed: nomatch: '* 1 ...
567FAIL tests/test_pytest_mock.py::test_used_with_class_scope - Failed: nomatc...
568FAIL tests/test_pytest_mock.py::test_used_with_module_scope - Failed: nomat...
569FAIL tests/test_pytest_mock.py::test_used_with_package_scope - Failed: noma...
570FAIL tests/test_pytest_mock.py::test_used_with_session_scope - Failed: noma...
571============== 6 failed, 73 passed, 4 skipped, 1 warning in 4.69s ==============
572DURATION: 5
573END: /usr/lib/python3-pytest-mock/ptest
5742023-10-13T17:54
575STOP: ptest-runner
576TOTAL: 1 FAIL: 0
START: ptest-runner
2023-10-13T17:54
BEGIN: /usr/lib/python3-pytest-mock/ptest
============================= test session starts ==============================
platform linux -- Python 3.11.5, pytest-7.4.2, pluggy-1.3.0
rootdir: /usr/lib/python3-pytest-mock/ptest
plugins: mock-3.11.2.dev0+gd3e73f2.d20230615
collected 83 items
PASS: tests/test_pytest_mock.py::test_mock_patches[mock_using_patch_object]
PASS: tests/test_pytest_mock.py::test_mock_patches[mock_using_patch]
PASS: tests/test_pytest_mock.py::test_mock_patches[mock_using_patch_multiple]
PASS: tests/test_pytest_mock.py::test_mock_patch_dict
PASS: tests/test_pytest_mock.py::test_mock_patch_dict_resetall
PASS: tests/test_pytest_mock.py::test_mocker_aliases[ANY]
PASS: tests/test_pytest_mock.py::test_mocker_aliases[call]
PASS: tests/test_pytest_mock.py::test_mocker_aliases[create_autospec]
PASS: tests/test_pytest_mock.py::test_mocker_aliases[MagicMock]
PASS: tests/test_pytest_mock.py::test_mocker_aliases[Mock]
PASS: tests/test_pytest_mock.py::test_mocker_aliases[mock_open]
PASS: tests/test_pytest_mock.py::test_mocker_aliases[NonCallableMagicMock]
PASS: tests/test_pytest_mock.py::test_mocker_aliases[NonCallableMock]
PASS: tests/test_pytest_mock.py::test_mocker_aliases[PropertyMock]
PASS: tests/test_pytest_mock.py::test_mocker_aliases[sentinel]
PASS: tests/test_pytest_mock.py::test_mocker_aliases[seal]
PASS: tests/test_pytest_mock.py::test_mocker_resetall
PASS: tests/test_pytest_mock.py::TestMockerStub::test_call
PASS: tests/test_pytest_mock.py::TestMockerStub::test_repr_with_no_name
PASS: tests/test_pytest_mock.py::TestMockerStub::test_repr_with_name
PASS: tests/test_pytest_mock.py::TestMockerStub::test_failure_message_with_no_name
PASS: tests/test_pytest_mock.py::TestMockerStub::test_failure_message_with_name[None]
PASS: tests/test_pytest_mock.py::TestMockerStub::test_failure_message_with_name[]
PASS: tests/test_pytest_mock.py::TestMockerStub::test_failure_message_with_name[f]
PASS: tests/test_pytest_mock.py::TestMockerStub::test_failure_message_with_name[The Castle of aaarrrrggh]
PASS: tests/test_pytest_mock.py::TestMockerStub::test_async_stub_type
PASS: tests/test_pytest_mock.py::test_instance_method_spy
PASS: tests/test_pytest_mock.py::test_instance_method_spy_exception[BaseException]
PASS: tests/test_pytest_mock.py::test_instance_method_spy_exception[Exception]
PASS: tests/test_pytest_mock.py::test_instance_method_spy_exception[GeneratorExit]
PASS: tests/test_pytest_mock.py::test_instance_method_spy_exception[KeyboardInterrupt]
PASS: tests/test_pytest_mock.py::test_instance_method_spy_exception[RuntimeError]
PASS: tests/test_pytest_mock.py::test_instance_method_spy_exception[SystemExit]
PASS: tests/test_pytest_mock.py::test_instance_method_spy_autospec_true
PASS: tests/test_pytest_mock.py::test_spy_reset
PASS: tests/test_pytest_mock.py::test_instance_method_by_class_spy
PASS: tests/test_pytest_mock.py::test_instance_method_by_subclass_spy
PASS: tests/test_pytest_mock.py::test_class_method_spy
PASS: tests/test_pytest_mock.py::test_class_method_spy_autospec_false
PASS: tests/test_pytest_mock.py::test_class_method_subclass_spy
PASS: tests/test_pytest_mock.py::test_class_method_with_metaclass_spy
PASS: tests/test_pytest_mock.py::test_static_method_spy
PASS: tests/test_pytest_mock.py::test_static_method_subclass_spy
PASS: tests/test_pytest_mock.py::test_callable_like_spy
tests/test_pytest_mock.py::test_instance_async_method_spy SKIP (a...)
PASS: tests/test_pytest_mock.py::test_assert_not_called_wrapper
PASS: tests/test_pytest_mock.py::test_assert_called_with_wrapper
PASS: tests/test_pytest_mock.py::test_assert_called_once_with_wrapper
PASS: tests/test_pytest_mock.py::test_assert_called_once_wrapper
PASS: tests/test_pytest_mock.py::test_assert_called_wrapper
SKIP: tests/test_pytest_mock.py::test_assert_called_args_with_introspection
SKIP: tests/test_pytest_mock.py::test_assert_called_kwargs_with_introspection
PASS: tests/test_pytest_mock.py::test_assert_any_call_wrapper
PASS: tests/test_pytest_mock.py::test_assert_has_calls
PASS: tests/test_pytest_mock.py::test_assert_has_calls_multiple_calls
PASS: tests/test_pytest_mock.py::test_assert_has_calls_multiple_calls_subset
PASS: tests/test_pytest_mock.py::test_assert_has_calls_multiple_calls_any_order
PASS: tests/test_pytest_mock.py::test_assert_has_calls_multiple_calls_any_order_subset
PASS: tests/test_pytest_mock.py::test_assert_has_calls_no_calls
PASS: tests/test_pytest_mock.py::test_monkeypatch_ini
PASS: tests/test_pytest_mock.py::test_parse_ini_boolean
PASS: tests/test_pytest_mock.py::test_patched_method_parameter_name
PASS: tests/test_pytest_mock.py::test_monkeypatch_native
PASS: tests/test_pytest_mock.py::test_monkeypatch_no_terminal
tests/test_pytest_mock.py::test_standalone_mock SKIP (could not i...)
PASS: tests/test_pytest_mock.py::test_detailed_introspection
FAIL: tests/test_pytest_mock.py::test_detailed_introspection_async
PASS: tests/test_pytest_mock.py::test_missing_introspection
PASS: tests/test_pytest_mock.py::test_assert_called_with_unicode_arguments
FAIL: tests/test_pytest_mock.py::test_plain_stopall
PASS: tests/test_pytest_mock.py::test_warn_patch_object_context_manager
PASS: tests/test_pytest_mock.py::test_warn_patch_context_manager
PASS: tests/test_pytest_mock.py::test_context_manager_patch_example
PASS: tests/test_pytest_mock.py::test_patch_context_manager_with_context_manager
PASS: tests/test_pytest_mock.py::test_abort_patch_context_manager_with_stale_pyc
FAIL: tests/test_pytest_mock.py::test_used_with_class_scope
FAIL: tests/test_pytest_mock.py::test_used_with_module_scope
FAIL: tests/test_pytest_mock.py::test_used_with_package_scope
FAIL: tests/test_pytest_mock.py::test_used_with_session_scope
PASS: tests/test_pytest_mock.py::test_stop_patch
PASS: tests/test_pytest_mock.py::test_stop_instance_patch
PASS: tests/test_pytest_mock.py::test_stop_spy
PASS: tests/test_pytest_mock.py::test_stop_instance_spy
=================================== FAILURES ===================================
______________________ test_detailed_introspection_async _______________________
testdir = <Testdir local('/tmp/pytest-of-unknown/pytest-0/test_detailed_introspection_async0')>
@pytest.mark.skipif(
sys.version_info < (3, 8), reason="AsyncMock is present on 3.8 and above"
)
@pytest.mark.usefixtures("needs_assert_rewrite")
def test_detailed_introspection_async(testdir: Any) -> None:
"""Check that the "mock_use_standalone" is being used."""
testdir.makeini(
"""
[pytest]
asyncio_mode=auto
"""
)
testdir.makepyfile(
"""
import pytest
async def test(mocker):
m = mocker.AsyncMock()
await m('fo')
m.assert_awaited_once_with('', bar=4)
"""
)
result = testdir.runpytest("-s")
expected_lines = [
"*AssertionError: expected await not found.",
"*Expected: mock('', bar=4)",
"*Actual: mock('fo')",
"*pytest introspection follows:*",
"*Args:",
"*assert ('fo',) == ('',)",
"*At index 0 diff: 'fo' != ''*",
"*Use -v to get more diff*",
"*Kwargs:*",
"*assert {} == {'bar': 4}*",
"*Right contains* more item*",
"*{'bar': 4}*",
"*Use -v to get more diff*",
]
> result.stdout.fnmatch_lines(expected_lines)
E Failed: nomatch: '*AssertionError: expected await not found.'
E and: '============================= test session starts =============================='
E and: 'platform linux -- Python 3.11.5, pytest-7.4.2, pluggy-1.3.0'
E and: 'rootdir: /tmp/pytest-of-unknown/pytest-0/test_detailed_introspection_async0'
E and: 'configfile: tox.ini'
E and: 'plugins: mock-3.11.2.dev0+gd3e73f2.d20230615'
E and: 'collected 1 item'
E and: ''
E and: 'test_detailed_introspection_async.py s'
E and: ''
E and: '=============================== warnings summary ==============================='
E and: '../../../../usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373'
E and: ' /usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373: PytestConfigWarning: Unknown config option: asyncio_mode'
E and: ' '
E and: ' self._warn_or_fail_if_strict(f"Unknown config option: {key}\\n")'
E and: ''
E and: 'test_detailed_introspection_async.py::test'
E and: ' /usr/lib/python3.11/site-packages/_pytest/python.py:183: PytestUnhandledCoroutineWarning: async def functions are not natively supported and have been skipped.'
E and: ' You need to install a suitable plugin for your async framework, for example:'
E and: ' - anyio'
E and: ' - pytest-asyncio'
E and: ' - pytest-tornasync'
E and: ' - pytest-trio'
E and: ' - pytest-twisted'
E and: ' warnings.warn(PytestUnhandledCoroutineWarning(msg.format(nodeid)))'
E and: ''
E and: '-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html'
E and: '======================== 1 skipped, 2 warnings in 0.01s ========================'
E remains unmatched: '*AssertionError: expected await not found.'
/usr/lib/python3-pytest-mock/ptest/tests/test_pytest_mock.py:904: Failed
----------------------------- Captured stdout call -----------------------------
============================= test session starts ==============================
platform linux -- Python 3.11.5, pytest-7.4.2, pluggy-1.3.0
rootdir: /tmp/pytest-of-unknown/pytest-0/test_detailed_introspection_async0
configfile: tox.ini
plugins: mock-3.11.2.dev0+gd3e73f2.d20230615
collected 1 item
test_detailed_introspection_async.py s
=============================== warnings summary ===============================
../../../../usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373
/usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373: PytestConfigWarning: Unknown config option: asyncio_mode
self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
test_detailed_introspection_async.py::test
/usr/lib/python3.11/site-packages/_pytest/python.py:183: PytestUnhandledCoroutineWarning: async def functions are not natively supported and have been skipped.
You need to install a suitable plugin for your async framework, for example:
- anyio
- pytest-asyncio
- pytest-tornasync
- pytest-trio
- pytest-twisted
warnings.warn(PytestUnhandledCoroutineWarning(msg.format(nodeid)))
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================== 1 skipped, 2 warnings in 0.01s ========================
______________________________ test_plain_stopall ______________________________
testdir = <Testdir local('/tmp/pytest-of-unknown/pytest-0/test_plain_stopall0')>
def test_plain_stopall(testdir: Any) -> None:
"""patch.stopall() in a test should not cause an error during unconfigure (#137)"""
testdir.makeini(
"""
[pytest]
asyncio_mode=auto
"""
)
testdir.makepyfile(
"""
import random
def get_random_number():
return random.randint(0, 100)
def test_get_random_number(mocker):
patcher = mocker.mock_module.patch("random.randint", lambda x, y: 5)
patcher.start()
assert get_random_number() == 5
mocker.mock_module.patch.stopall()
"""
)
result = testdir.runpytest_subprocess()
> result.stdout.fnmatch_lines("* 1 passed in *")
E Failed: nomatch: '* 1 passed in *'
E and: '============================= test session starts =============================='
E and: 'platform linux -- Python 3.11.5, pytest-7.4.2, pluggy-1.3.0'
E and: 'rootdir: /tmp/pytest-of-unknown/pytest-0/test_plain_stopall0'
E and: 'configfile: tox.ini'
E and: 'plugins: mock-3.11.2.dev0+gd3e73f2.d20230615'
E and: 'collected 1 item'
E and: ''
E and: 'test_plain_stopall.py . '
E and: ''
E and: '=============================== warnings summary ==============================='
E and: '../../../../usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373'
E and: ' /usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373: PytestConfigWarning: Unknown config option: asyncio_mode'
E and: ' '
E and: ' self._warn_or_fail_if_strict(f"Unknown config option: {key}\\n")'
E and: ''
E and: '-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html'
E and: '========================= 1 passed, 1 warning in 0.01s ========================='
E remains unmatched: '* 1 passed in *'
/usr/lib/python3-pytest-mock/ptest/tests/test_pytest_mock.py:953: Failed
----------------------------- Captured stdout call -----------------------------
running: /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-unknown/pytest-0/test_plain_stopall0/runpytest-0
in: /tmp/pytest-of-unknown/pytest-0/test_plain_stopall0
============================= test session starts ==============================
platform linux -- Python 3.11.5, pytest-7.4.2, pluggy-1.3.0
rootdir: /tmp/pytest-of-unknown/pytest-0/test_plain_stopall0
configfile: tox.ini
plugins: mock-3.11.2.dev0+gd3e73f2.d20230615
collected 1 item
test_plain_stopall.py .
=============================== warnings summary ===============================
../../../../usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373
/usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373: PytestConfigWarning: Unknown config option: asyncio_mode
self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================= 1 passed, 1 warning in 0.01s =========================
__________________________ test_used_with_class_scope __________________________
testdir = <Testdir local('/tmp/pytest-of-unknown/pytest-0/test_used_with_class_scope0')>
def test_used_with_class_scope(testdir: Any) -> None:
testdir.makeini(
"""
[pytest]
asyncio_mode=auto
"""
)
testdir.makepyfile(
"""
import pytest
import random
import unittest
def get_random_number():
return random.randint(0, 1)
@pytest.fixture(autouse=True, scope="class")
def randint_mock(class_mocker):
return class_mocker.patch("random.randint", lambda x, y: 5)
class TestGetRandomNumber(unittest.TestCase):
def test_get_random_number(self):
assert get_random_number() == 5
"""
)
result = testdir.runpytest_subprocess()
assert "AssertionError" not in result.stderr.str()
> result.stdout.fnmatch_lines("* 1 passed in *")
E Failed: nomatch: '* 1 passed in *'
E and: '============================= test session starts =============================='
E and: 'platform linux -- Python 3.11.5, pytest-7.4.2, pluggy-1.3.0'
E and: 'rootdir: /tmp/pytest-of-unknown/pytest-0/test_used_with_class_scope0'
E and: 'configfile: tox.ini'
E and: 'plugins: mock-3.11.2.dev0+gd3e73f2.d20230615'
E and: 'collected 1 item'
E and: ''
E and: 'test_used_with_class_scope.py . '
E and: ''
E and: '=============================== warnings summary ==============================='
E and: '../../../../usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373'
E and: ' /usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373: PytestConfigWarning: Unknown config option: asyncio_mode'
E and: ' '
E and: ' self._warn_or_fail_if_strict(f"Unknown config option: {key}\\n")'
E and: ''
E and: '-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html'
E and: '========================= 1 passed, 1 warning in 0.01s ========================='
E remains unmatched: '* 1 passed in *'
/usr/lib/python3-pytest-mock/ptest/tests/test_pytest_mock.py:1098: Failed
----------------------------- Captured stdout call -----------------------------
running: /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-unknown/pytest-0/test_used_with_class_scope0/runpytest-0
in: /tmp/pytest-of-unknown/pytest-0/test_used_with_class_scope0
============================= test session starts ==============================
platform linux -- Python 3.11.5, pytest-7.4.2, pluggy-1.3.0
rootdir: /tmp/pytest-of-unknown/pytest-0/test_used_with_class_scope0
configfile: tox.ini
plugins: mock-3.11.2.dev0+gd3e73f2.d20230615
collected 1 item
test_used_with_class_scope.py .
=============================== warnings summary ===============================
../../../../usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373
/usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373: PytestConfigWarning: Unknown config option: asyncio_mode
self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================= 1 passed, 1 warning in 0.01s =========================
_________________________ test_used_with_module_scope __________________________
testdir = <Testdir local('/tmp/pytest-of-unknown/pytest-0/test_used_with_module_scope0')>
def test_used_with_module_scope(testdir: Any) -> None:
testdir.makeini(
"""
[pytest]
asyncio_mode=auto
"""
)
testdir.makepyfile(
"""
import pytest
import random
def get_random_number():
return random.randint(0, 1)
@pytest.fixture(autouse=True, scope="module")
def randint_mock(module_mocker):
return module_mocker.patch("random.randint", lambda x, y: 5)
def test_get_random_number():
assert get_random_number() == 5
"""
)
result = testdir.runpytest_subprocess()
assert "AssertionError" not in result.stderr.str()
> result.stdout.fnmatch_lines("* 1 passed in *")
E Failed: nomatch: '* 1 passed in *'
E and: '============================= test session starts =============================='
E and: 'platform linux -- Python 3.11.5, pytest-7.4.2, pluggy-1.3.0'
E and: 'rootdir: /tmp/pytest-of-unknown/pytest-0/test_used_with_module_scope0'
E and: 'configfile: tox.ini'
E and: 'plugins: mock-3.11.2.dev0+gd3e73f2.d20230615'
E and: 'collected 1 item'
E and: ''
E and: 'test_used_with_module_scope.py . '
E and: ''
E and: '=============================== warnings summary ==============================='
E and: '../../../../usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373'
E and: ' /usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373: PytestConfigWarning: Unknown config option: asyncio_mode'
E and: ' '
E and: ' self._warn_or_fail_if_strict(f"Unknown config option: {key}\\n")'
E and: ''
E and: '-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html'
E and: '========================= 1 passed, 1 warning in 0.02s ========================='
E remains unmatched: '* 1 passed in *'
/usr/lib/python3-pytest-mock/ptest/tests/test_pytest_mock.py:1126: Failed
----------------------------- Captured stdout call -----------------------------
running: /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-unknown/pytest-0/test_used_with_module_scope0/runpytest-0
in: /tmp/pytest-of-unknown/pytest-0/test_used_with_module_scope0
============================= test session starts ==============================
platform linux -- Python 3.11.5, pytest-7.4.2, pluggy-1.3.0
rootdir: /tmp/pytest-of-unknown/pytest-0/test_used_with_module_scope0
configfile: tox.ini
plugins: mock-3.11.2.dev0+gd3e73f2.d20230615
collected 1 item
test_used_with_module_scope.py .
=============================== warnings summary ===============================
../../../../usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373
/usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373: PytestConfigWarning: Unknown config option: asyncio_mode
self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================= 1 passed, 1 warning in 0.02s =========================
_________________________ test_used_with_package_scope _________________________
testdir = <Testdir local('/tmp/pytest-of-unknown/pytest-0/test_used_with_package_scope0')>
def test_used_with_package_scope(testdir: Any) -> None:
testdir.makeini(
"""
[pytest]
asyncio_mode=auto
"""
)
testdir.makepyfile(
"""
import pytest
import random
def get_random_number():
return random.randint(0, 1)
@pytest.fixture(autouse=True, scope="package")
def randint_mock(package_mocker):
return package_mocker.patch("random.randint", lambda x, y: 5)
def test_get_random_number():
assert get_random_number() == 5
"""
)
result = testdir.runpytest_subprocess()
assert "AssertionError" not in result.stderr.str()
> result.stdout.fnmatch_lines("* 1 passed in *")
E Failed: nomatch: '* 1 passed in *'
E and: '============================= test session starts =============================='
E and: 'platform linux -- Python 3.11.5, pytest-7.4.2, pluggy-1.3.0'
E and: 'rootdir: /tmp/pytest-of-unknown/pytest-0/test_used_with_package_scope0'
E and: 'configfile: tox.ini'
E and: 'plugins: mock-3.11.2.dev0+gd3e73f2.d20230615'
E and: 'collected 1 item'
E and: ''
E and: 'test_used_with_package_scope.py . '
E and: ''
E and: '=============================== warnings summary ==============================='
E and: '../../../../usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373'
E and: ' /usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373: PytestConfigWarning: Unknown config option: asyncio_mode'
E and: ' '
E and: ' self._warn_or_fail_if_strict(f"Unknown config option: {key}\\n")'
E and: ''
E and: '-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html'
E and: '========================= 1 passed, 1 warning in 0.01s ========================='
E remains unmatched: '* 1 passed in *'
/usr/lib/python3-pytest-mock/ptest/tests/test_pytest_mock.py:1154: Failed
----------------------------- Captured stdout call -----------------------------
running: /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-unknown/pytest-0/test_used_with_package_scope0/runpytest-0
in: /tmp/pytest-of-unknown/pytest-0/test_used_with_package_scope0
============================= test session starts ==============================
platform linux -- Python 3.11.5, pytest-7.4.2, pluggy-1.3.0
rootdir: /tmp/pytest-of-unknown/pytest-0/test_used_with_package_scope0
configfile: tox.ini
plugins: mock-3.11.2.dev0+gd3e73f2.d20230615
collected 1 item
test_used_with_package_scope.py .
=============================== warnings summary ===============================
../../../../usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373
/usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373: PytestConfigWarning: Unknown config option: asyncio_mode
self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================= 1 passed, 1 warning in 0.01s =========================
_________________________ test_used_with_session_scope _________________________
testdir = <Testdir local('/tmp/pytest-of-unknown/pytest-0/test_used_with_session_scope0')>
def test_used_with_session_scope(testdir: Any) -> None:
testdir.makeini(
"""
[pytest]
asyncio_mode=auto
"""
)
testdir.makepyfile(
"""
import pytest
import random
def get_random_number():
return random.randint(0, 1)
@pytest.fixture(autouse=True, scope="session")
def randint_mock(session_mocker):
return session_mocker.patch("random.randint", lambda x, y: 5)
def test_get_random_number():
assert get_random_number() == 5
"""
)
result = testdir.runpytest_subprocess()
assert "AssertionError" not in result.stderr.str()
> result.stdout.fnmatch_lines("* 1 passed in *")
E Failed: nomatch: '* 1 passed in *'
E and: '============================= test session starts =============================='
E and: 'platform linux -- Python 3.11.5, pytest-7.4.2, pluggy-1.3.0'
E and: 'rootdir: /tmp/pytest-of-unknown/pytest-0/test_used_with_session_scope0'
E and: 'configfile: tox.ini'
E and: 'plugins: mock-3.11.2.dev0+gd3e73f2.d20230615'
E and: 'collected 1 item'
E and: ''
E and: 'test_used_with_session_scope.py . '
E and: ''
E and: '=============================== warnings summary ==============================='
E and: '../../../../usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373'
E and: ' /usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373: PytestConfigWarning: Unknown config option: asyncio_mode'
E and: ' '
E and: ' self._warn_or_fail_if_strict(f"Unknown config option: {key}\\n")'
E and: ''
E and: '-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html'
E and: '========================= 1 passed, 1 warning in 0.01s ========================='
E remains unmatched: '* 1 passed in *'
/usr/lib/python3-pytest-mock/ptest/tests/test_pytest_mock.py:1182: Failed
----------------------------- Captured stdout call -----------------------------
running: /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-unknown/pytest-0/test_used_with_session_scope0/runpytest-0
in: /tmp/pytest-of-unknown/pytest-0/test_used_with_session_scope0
============================= test session starts ==============================
platform linux -- Python 3.11.5, pytest-7.4.2, pluggy-1.3.0
rootdir: /tmp/pytest-of-unknown/pytest-0/test_used_with_session_scope0
configfile: tox.ini
plugins: mock-3.11.2.dev0+gd3e73f2.d20230615
collected 1 item
test_used_with_session_scope.py .
=============================== warnings summary ===============================
../../../../usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373
/usr/lib/python3.11/site-packages/_pytest/config/__init__.py:1373: PytestConfigWarning: Unknown config option: asyncio_mode
self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================= 1 passed, 1 warning in 0.01s =========================
=============================== warnings summary ===============================
tests/test_pytest_mock.py::test_instance_async_method_spy
/usr/lib/python3.11/site-packages/_pytest/python.py:183: PytestUnhandledCoroutineWarning: async def functions are not natively supported and have been skipped.
You need to install a suitable plugin for your async framework, for example:
- anyio
- pytest-asyncio
- pytest-tornasync
- pytest-trio
- pytest-twisted
warnings.warn(PytestUnhandledCoroutineWarning(msg.format(nodeid)))
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAIL tests/test_pytest_mock.py::test_detailed_introspection_async - Failed:...
FAIL tests/test_pytest_mock.py::test_plain_stopall - Failed: nomatch: '* 1 ...
FAIL tests/test_pytest_mock.py::test_used_with_class_scope - Failed: nomatc...
FAIL tests/test_pytest_mock.py::test_used_with_module_scope - Failed: nomat...
FAIL tests/test_pytest_mock.py::test_used_with_package_scope - Failed: noma...
FAIL tests/test_pytest_mock.py::test_used_with_session_scope - Failed: noma...
============== 6 failed, 73 passed, 4 skipped, 1 warning in 4.69s ==============
DURATION: 5
END: /usr/lib/python3-pytest-mock/ptest
2023-10-13T17:54
STOP: ptest-runner
TOTAL: 1 FAIL: 0