February 2022
Intermediate to advanced
274 pages
6h 28m
English
In the last chapter, we tested the Cards project through the API. In this chapter, we’re going to test the CLI. When we wrote the test strategy for the Cards project in Writing a Test Strategy, we included the following statement:
We’re going to use the mock package to help us with that. Shipped as part of the Python standard library as unittest.mock as of Python 3.3,[34] the mock package is used to swap out pieces of the system to isolate bits of our application code from the rest of the system. Mock objects are sometimes called test doubles, spies, fakes, or stubs. Between pytest’s own monkeypatch fixture (covered in Using monkeypatch
Read now
Unlock full access