There are 5 bugs in this implementation of snowman. Practice using your debugging skills to locate, diagnose, and fix the bugs. For each bug note:
- In which function it was found
- The line (or lines) causing the problem
- What about the line was causing the problem
- What needed to be done to fix the problem
- How you located the bug
Follow these directions once, at the beginning of the activity:
-
Navigate to your projects folder named
projects
$ cd ~/Developer/projects
-
If you would like to be able to keep your work in GitHub, click on the "Fork" button on the GitHub to fork the repository to your GitHub account.
-
"Clone" (download a copy of this project) into your projects folder. This command makes a new folder called
snowbug
, and then puts the activity into this new folder. If you forked the activity, be sure to clone from your forked copy.$ git clone ...
Use
ls
to confirm there's a new activity folder -
Move your location into this activity folder
$ cd snowbug
-
Create a virtual environment named
venv
for this activity:$ python3 -m venv venv
-
Activate this environment:
$ source venv/bin/activate
Verify that you're in a python3 virtual environment by running:
$ python --version
should output a Python 3 version$ pip --version
should output that it is working with Python 3
-
Install dependencies once at the beginning of this project with
# Must be in activated virtual environment $ pip install -r requirements.txt
Summary of one-time project setup:
-
cd
into yourprojects
folder - Clone the activity onto your machine
-
cd
into thesnowbug
folder - Create the virtual environment
venv
- Activate the virtual environment
venv
- Install the dependencies with
pip
-
While in the activity directory, launch VS Code.
$ code .
-
Perform test configuration by going to the Testing panel (shaped like a beaker) and clicking Configure Python Tests. Select pytest as the framework and tests as the location of the tests.
-
Run the tests using the VS Code testing tools.
-
Focus on the top test failure. Read through the test failure, and understand why the failure is happening.
-
Make a plan to fix the test failure.
-
Write code to fix the test failure.
-
Re-run the tests.
-
Continue running tests until all bugs have been fixed.
Make note of your investigation, especially the 5 questions in the goal, and be prepared to share your findings with your classmates!