Giter Club home page Giter Club logo

code-coverage-dict-exercise's Introduction

Code Coverage Exercise

In this exercise you will work with your group to get to full code coverage and fix any bugs that you find.

Setup

  1. On Github, click on the "Fork" button in the top right corner and fork the repository to your Github account. This will make a copy of the project in your Github account.

  2. On Github, add the other member(s) of your team as collaborators to your fork of the repository. To do this the student who forked the repository should first choose "Settings" from the top menu bar (underneath the bar with the "Pin" button), then under the "Access" heading select "Collaborators", then under "Manage access" select "Add people".

  3. Clone a copy of this exercise. This command makes a new folder called code-coverage-dict-exercise, and then puts the exercise into this new folder. Get the actual clone path (not ...) from GitHub.

git clone ...

Use ls to confirm there's a new project folder

  1. Move your location into this project folder
cd code-coverage-dict-exercise
  1. Create a virtual environment named venv for this project:
python3 -m venv venv
  1. 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
  1. Install dependencies once at the beginning of this exercise with
# Must be in activated virtual environment
pip install -r requirements.txt
  1. Exit and re-enter the virtual environment with the following command. This is needed to ensure the correct version of pytest is used in the terminal.
deactivate && source venv/bin/activate

Checking Code Coverage

To check the code coverage you can run:

pytest --cov=student --cov-report html --cov-report term

To see the detailed report (after running the above) you can open it in your default browser with:

open htmlcov/index.html

The above commands need to be run from the root folder of the project.

Running the commands in the terminal: Running the commands in the terminal

Once you've loaded the detailed report you can click on the file names to see information about what lines are missing code coverage.

The front page of the detailed report: Report Index

The details for student/student.py: Report Index

The lines with coverage have a green line by their line number, the lines without coverage have a red one and a highlighted background.

To read more about pytest-cov you can consult the pytest-cov documentation.

code-coverage-dict-exercise's People

Contributors

anselrognlie avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.