alecksphillips/wallpaperfm — pull request #2 by hugovk (2014-03-16 09:22:47+00:00)
Title: Add support for Python 2 and fix --Local bug. Add CI with coverage.

I decided to add support for Python 2.7 and added it to Travis CI to be sure it still worked on Python 3. To run on the CI, I added some simple test cases. Whilst I was at it, I added test coverage measurements.

It turns out only one thing was needed for Python 2:
```
try:
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
```

It runs OK on the CI for Python 2.6, 2.7, 3.2 and 3.3.

I also fixed one bug:

If you use the --Local option, but no local chart file exists yet, it just gave up. Now, it will download and cache it the first time if the file doesn't exist.

The README has Travis CI build status and Coveralls coverage badges. You may want to remove them or update them with your URLs. Both are free services for open source Github repos. All you'll need to do is enable on the repos for each and it should work. (Although Coveralls is in the middle of a server migration and they're having intermittent problems and patchy service, but it won't affect the Travis builds.)

To run tests locally:
`./test_wallpaperfm.py`

Or to run with coverage, first install `coverage` and generate a report:
```
pip install coverage
./test_wallpaperfm.py
coverage html
open htmlcov/index.html
```

Let me know if you've any questions!