Found 7 bookmarks
Custom sorting
Python: capture stdout and stderr in unittest - Adam Johnson
Python: capture stdout and stderr in unittest - Adam Johnson
When testing code that outputs to the terminal through either standard out (stdout) or standard error (stderr), you might want to capture that output and make assertions on it. To do so, use contextlib.redirect_stdout() and contextlib.redirect_stderr() to redirect the respective output streams to in-memory buffers that you can then inspect and assert on.
·adamj.eu·
Python: capture stdout and stderr in unittest - Adam Johnson
Understanding the Python Mock Object Library – Real Python
Understanding the Python Mock Object Library – Real Python
In this tutorial, you'll learn how to use the Python mock object library, unittest.mock, to create and use mock objects to improve your tests. Obstacles like complex logic and unpredictable dependencies make writing valuable tests difficult, but unittest.mock can help you overcome these obstacles.
·realpython.com·
Understanding the Python Mock Object Library – Real Python
Pytest for Beginners
Pytest for Beginners
This article looks at the very basics of using pytest for testing Python code.
·testdriven.io·
Pytest for Beginners