学习笔记之pytest
pytest: helps you write better programs — pytest documentation
- https://docs.pytest.org/en/stable/
- Installation and Getting Started — pytest documentation
pytest
will run all files of the form test_*.py or *_test.py in the current directory and its subdirectories. More generally, it follows standard test discovery rules.- Execute the test function with “quiet” reporting mode:
- $ pytest -q test_sysexit.py
pytest
discovers all tests following its Conventions for Python test discovery, so it finds bothtest_
prefixed functions. There is no need to subclass anything, but make sure to prefix your class withTest
otherwise the class will be skipped.
- pytest fixtures: explicit, modular, scalable — pytest documentation
- Asserting about exceptions with pytest.raises
List of unit testing frameworks - Wikipedia
- https://en.wikipedia.org/wiki/List_of_unit_testing_frameworks