If you run into issues running Python unit tests with Tox after enabling the logging, you may have to add some additional code not covered in the video. See this page: Example 5 Python Updates
Resources
Configuring Codio Debugger
Edit src/__main__.py
to set Python path:
import sys
sys.path.append("/home/codio/workspace/python/")
Make sure src/__main__.py
imports and calls correct main
method.
Can copy unit test code to a test main
function for testing. Codio doesn’t have a good way to individually debug a single unit test, but some IDEs do.
Tox Changes
In the tox.ini
file, we added the following line under the [testenv]
heading:
ignore_errors = True
This will allow the full Tox script to execute, even if there are errors earlier in the process.
We also removed the line to generate documentation, as it is not needed.
Outline
Here is a basic outline of the steps to follow to complete this example.
- Clone Starter Code from GitHub
git clone <url> python
- Run Project
cd python
python3 -m src
- Install Tox
pip3 install tox
- Check & Test Existing Project
python3 -m tox
-
Confirm that project runs, no style errors, and tests execute (some tests will fail).
-
Fix Code to Pass Unit Tests. Use Codio debugger and/or Logging
-
Add logging to both files
-
Add
README.md
and discuss how you solved the errors. -
Confirm that project runs and all tests pass.
-
When complete, use Git to commit and push updated code.
git add .
git commit -m "Example Complete"
git push
- On GitHub, create a release tag and submit URL to Canvas for grading.