How to use pytest capsys on tests that have mocking decorators?
问题 I have being trying to find a way to use mocking decorators and pytest capsys at the same time but I wasn't able to find the right way to do it. import pytest import requests_mock @requests_mock.mock() def test_with_mock(m): pass def test_with_capsys(capsys): pass # how to write a test that works with both? 回答1: As stated in the request-mock's docs: pytest has its own method of registering and loading custom fixtures. requests-mock provides an external fixture registered with pytest such that