python-imaging/Pillow — pull request #607 by hugovk (2014-04-08 16:05:47+00:00)
Title: Fix test coverage

Coverage now up to 65%. It was 43%, just from the selftest.

As @wiredfool [noticed here](https://github.com/python-imaging/Pillow/pull/604#issuecomment-39770473) the coverage report was missing some lines, so I investigated why.

The main problem was coverage was being run from .travis.yml on the command line like this:

`coverage run --append --include=PIL/* Tests/run.py`

But run.py runs the individual tests through a series of `os.popen()` calls. Instead, it makes more sense to use coverage.py's API (`import coverage; coverage.start()` etc). But look! tester.py already has a `--coverage`. It needed some fixes:

* Move the start to the start of `_setup()` so it starts measuring right away and covers everything.

* Use the options `auto_data=True, include="PIL/*"`. The first loads any existing coverage data, and saves it at the end (so like `--append`). The second just measures code in the PIL directory.

* Remove the `coverage.stop()` as the end as coverage.py has been updated and it's not needed as it causes exceptions. `coverage.the_coverage.save()` is done using `auto_data=True`.

Also:

* Remove pep8 warnings.

* Update .gitignore from https://github.com/github/gitignore, keeping the stuff from before.