I write tests that generate a lot of debug messages to console and file. pytest captures all output from tests and displays them when a test fails. This behavior is exacerbated when there are a large number of tests within a test run. Since I already log these messages to file I don't need pytest to display them on the console. I'd rather it showed me its own reports only.

This issue is further exacerbated when others run the same tests. All they care about is whether the test passed or failed and don't need to see the details. In case the test failed the debug log files already have the required information.

pytest-hidecaptured is a pytest plug-in that removes captured output so it is not displayed.


You can install "pytest-hidecaptured" via pip from PyPI:

$ pip install pytest-hidecaptured


After installing pytest-hidecaputred use pytest the way you have always used. There is no additional step required and no additional flag(s) added.


If you find this useful: use it, star it, contribute to it.

Main development is done on GitHub and the issue tracker is also there. Repo is mirrored on GitLab and BitBucket, and contributions in any of these places are welcome.


Distributed under the terms of the MIT license, "pytest-hidecaptured" is free and open source software.


If you encounter any problems, please file an issue along with a detailed description.