Overview of what we have learned
The following sections will summarize what we have learned in this book.
Introduction
- You should consider writing tests as your safety net. It will make you more confident in your work, allow you to refactor with confidence, and be certain that you are not breaking other parts of the system.
- A test suite is a must-have if you are porting a Python 2 code base to Python 3, as any guide will tell you, (https://docs.python.org/3/howto/pyporting.html#have-good-test-coverage).
- It is a good idea to write tests for the external APIs you depend on, if they don't have automated tests.
- One of the reasons pytest is a great choice for beginners is because it is easy to get started; write your tests using simple functions and
assert
statements.
Writing and running tests
- Always use a virtual environment to manage your packages and dependencies. This advice goes for any Python project.
- pytest introspection features make it easy to express your checks concisely; it is easy to compare...