
# pytest-blame

![logo](https://raw.githubusercontent.com/inTestiGator/pytest-blame/doc/readme/.github/blame-icon.png)

---

[![Build Status](https://api.travis-ci.com/inTestiGator/pytest-blame.svg?branch=master)](
https://travis-ci.com/inTestiGator/pytest-blame)
[![codecov.io](https://img.shields.io/codecov/c/github/inTestiGator/pytest-blame/master.svg)](
http://codecov.io/github/inTestiGator/pytest-blame?branch=master)
[![made-with-python](http://img.shields.io/badge/Made%20with-Python-blue.svg)](
https://www.python.org/)
[![PyPI version](https://img.shields.io/pypi/v/pytest-blame.svg)](https://pypi.org/project/pytest-blame/)
[<img src="https://img.shields.io/github/release/inTestiGator/pytest-blame.svg" />](https://github.com/inTestiGator/pytest-blame/releases)
[![gitter-join-chat](https://badges.gitter.im/Join%20Chat.svg)](
https://gitter.im/pytest-blame/community)

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.

## Installation

---

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 setup.py 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:*

<!-- TODO: 1080p minimum resolution, widescreen gifs -->
<!-- HTML is used here to specify the relative size for the gifs -->
<img src="https://raw.githubusercontent.com/inTestiGator/pytest-blame/doc/readme/.github/key1.gif" alt="key1 gif" width="80%" height="80%"/>

*Find ``Developer Settings`` in the dashboard on the left and navigate to
``Personal Access Tokens``*

<img src="https://raw.githubusercontent.com/inTestiGator/pytest-blame/doc/readme/.github/key2.gif" alt="key2 gif" width="80%" height="80%"/>

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

<img src="https://raw.githubusercontent.com/inTestiGator/pytest-blame/doc/readme/.github/key3.gif" alt="key3 gif" width="80%" height="80%"/>
<!-- -->

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``.

run pytest with the ``--track`` flag and you will see a report containing GitHub
information at the top of your pytest report. ``pytest-blame`` will display the
number of test cases that passed in the latest commit to GitHub, so you can
compare it with your current rate.

To run:
Running ``pytest --track tests/`` will invoke ``pytest-blame``, which will display
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
```

<!-- TODO: add sample pytest-blame output -->
```

```

## The Team

Check out the Pytest Blame Team!

<!-- TODO: Add team profile images with links to github accounts -->
