Tags » python » pytest
TIL: Collecting pytest markers from failing tests
You can annotate tests with markers, and using the
pytest_collection_modifyitems
andpytest_terminal_summary
hooks you can get a list of markers for tests that failed.TIL: How to simulate an
[Errno 54] Connection reset by peer
when using pytestYou can run a TCP server in the background using a fixture, and using the
SO_LINGER
socket option can reset the connection.TIL: Run a randomly selected subset of tests with pytest
By reading the code for the
pytest-random-order
plugin, I was able to write a new plugin that runs a random subset of tests.Why I use py.test
Why py.test is my unit test framework of choice in Python.