Skip to main content

A pytest plugin helps developers to debug by providing useful commits history.

Project description



Build Status Codacy Badge made-with-python PyPI version gitter-join-chat

A pytest plugin that helps developers build successful test cases by providing them with GitHub commit information when their test cases fail.

A Python Plugin for Tracking Test Case Status

Everyone uses pytest. Or at least, everyone should. It's a super useful testing program with an easy-to-use syntax. Pytest Blame is a pytest plugin that allows pytest to do a quick check to Github to make sure the most recent commit is passing your cases. If somebody broke your cases, pytest-blame will display all the commits pushed since the build broke as well as who pushed each commit. This keeps team workflow transparent and allows for semi-realtime updates from Github without having to open a browser. Since pytest-blame can check up on the online repository as frequently as every time you run your test suite, there is less risk of a broken commit going unnoticed until a merge conflict occurs.


To install pytest-blame you will need to clone this github repository. Once the repository has been cloned you will need to run the install script to update your pytest configuration:

pipenv run python install

After pytest-blame has been successfully installed you will need to generate a Github User Token.

This can be found under Settings in your github profile:

key1 gif

Then, find Developer Settings in the dashboard on the left and navigate to Personal Access Tokens.

key2 gif

Finally, when generating the key for pytest-blame make sure to include rights to repo and hooks

key3 gif

Now that you have a user token, you will need to paste it into the location where your terminal is sourced from. For example: Ubuntu uses bash, so the default terminal source for ubuntu is .bashrc.

You should put the following code in dot files to set up environment variable:


If you are using Windows, you can go to Control Panel -> System and Security -> System -> Advanced system settings -> Advanced -> Environment Variables to set it up.


You can run pytest with the --track option and you will see a report containing GitHub information at the top of your pytest report. pytest-blame will display the most recent commit that is passing CI check, and all commits that did not pass CI check between the most recent commit and the most recent passing commit.

To run: pytest --track tests/ will invoke pytest-blame, displaying the current status of your working branch in the pytest header.

Sample output

A successful pytest-blame run will look something like this:

pytest --track tests/


The most recent commit is passing:
Lancaster Wu : Delete


Most recent passing commit:

Patrick Palad: Disable pylint check

Failing commit:
Spencer Huang: return to passing commit

Failing commit:
Spencer Huang: failing commit

Failing commit:
Spencer Huang: failling commit

Failing commit:
Spencer Huang: fail test

The last one is the most recent commit

You may also recieve messages telling you that can not find passing commits when all commits are currently failing or pending.

Failing Travis build

The master branch is failing Travis because one of our test cases requires Travis to have access to our test repository and currently and it doesn't, so it cannot perform the actual testing. This test case passes locally.

The Team

Check out the Pytest Blame Team!

Carson Quigley

Lancaster Wu

Spencer Huang

Patrick Palad

Paul Livingston

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest-blame-0.1.7.tar.gz (6.8 kB view hashes)

Uploaded Source

Built Distribution

pytest_blame-0.1.7-py3-none-any.whl (20.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page