Listing 3-9. __init__.py
all = ["test_module01", "test_module02", "test_module03", "test_module04",
"test_module05", "test_module06", "test_module07"]
Congratulations! You just created a test package. test is the name of the testing
package and all modules mentioned in the __init__.py belong to this package. If you
need to add a new testing module to the package test, you need to create a new test
module file in the test directory and then add the name of that module to the __init__.
py file.
Now you can run the test modules from the parent directory of test (chapter03) in
the following way. Move to the chapter03 directory using the following command:
cd /home/pi/book/code/chapter03
Note that the path might be different in your case, depending on where you have
created the book directory.
Run the test module with the following command:
python3 -m unittest -v test.test_module04
Do'stlaringiz bilan baham: |