It is time to write some unit tests for the application. We will make a new subclass of unittest.TestCase
to hold all the unit tests.
As a first step, let's create a new package for holding the test cases. Create a new directory called test
at the same level where you have the rest of the code. Next, create two new files inside this test
directory, as shown here:
The test_wargame.py
module is where new unit tests will be created. To recognize the directory as a Python package, add an empty __init__.py
file.
Tip
If you haven't already, read Chapter 3, Modularize, Package, Deploy! for details on creating a Python package.