Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Travis CI and Coveralls #19

Merged
merged 22 commits into from
Oct 17, 2016
Merged

Add Travis CI and Coveralls #19

merged 22 commits into from
Oct 17, 2016

Conversation

hugovk
Copy link
Contributor

@hugovk hugovk commented Oct 26, 2014

I've added a configuration file so Travis CI will build each commit and pull request. It runs against each Python version supported by Travis CI: 2.6, 2.7, 3.2, 3.3, 3.4, PyPy and PyPy3, and all of them pass with no changes needed. This will help maintain the codebase by automatically running the tests against all Python versions for each PR -- it's very handy for picking up those Py2/Py3 inconsistencies..

It also runs the tests with coverage enabled, and sends the coverage reports to Coveralls, so you can see how coverage changes, or if a PR doesn't include tests to cover its new code. Right now, inflect.py has an amazing 98% coverage!

You get reports like this:

I've added badges to the README to show off how good stats this project has. Both Travis CI and Coveralls are free for open source project, you just need to enable them for the repo. Please can you do so at:

Thanks!

@hugovk
Copy link
Contributor Author

hugovk commented Jun 8, 2015

Ping @agronholm!

@hugovk
Copy link
Contributor Author

hugovk commented Nov 10, 2015

@pwdyson @agronholm I've updated the PR for the newly-released Python 3.5; everything still passes. What are your thoughts about merging this PR?

@hugovk
Copy link
Contributor Author

hugovk commented Oct 15, 2016

@agronholm I've resolved the merge conflict. Everything still passes on Travis CI, and coverage remains at 98%.

@agronholm
Copy link
Collaborator

I don't want to be the maintainer of this project anymore – I only signed up to make it Python 3 compatible. So this will be the last PR I'll handle here.

Thoughts:

  • The .gitignore file looks unnecessarily verbose. What is wrong with the existing one?
  • I think we can drop tests for Python 2.6, given how it's 3 years past its End Of Life already
  • (C)Python 3.2 is also past its EOL
  • Since we have a tox.ini, it would be nice to use tox-travis for the integration
  • Instead of pep8 and pyflakes checking in after_scripts, I'd much prefer flake8 checking in the test suite itself. Here's how I do it: https://github.com/agronholm/apscheduler/blob/master/tox.ini

@hugovk
Copy link
Contributor Author

hugovk commented Oct 15, 2016

Fair enough, and thanks for the maintenance so far and also for adding Python 3!

  • The .gitignore file looks unnecessarily verbose. What is wrong with the existing one?

The existing one is mostly fine, but the new one uses a template from https://github.com/github/gitignore that covers many standard files that Python projects may generate that we wouldn't want committing to the repo. At least we'd want .coverage adding. Do you want me to revert to the original and just add .coverage?

  • I think we can drop tests for Python 2.6, given how it's 3 years past its End Of Life already
  • (C)Python 3.2 is also past its EOL

Both removed.

Good ideas, I'll update it.

@agronholm
Copy link
Collaborator

Adding just .coverage should do it.

@agronholm
Copy link
Collaborator

agronholm commented Oct 15, 2016

Note that Travis has to be enabled from the Github admin panel to which I have no access in this project.

@hugovk
Copy link
Contributor Author

hugovk commented Oct 15, 2016

@pwdyson Please could you enable Travis CI and Coveralls for this repo?

@agronholm
Copy link
Collaborator

Instead of updating how pyflakes is run, why not switch to flake8 that combines both?

@hugovk
Copy link
Contributor Author

hugovk commented Oct 15, 2016

Three reasons for separate commands:

  • we see results of pyflakes (possible coding errors) and pep8 (style warnings) separately instead of mixed,
  • we have some stats and a summary from pep8,
  • running pyflakes fails with 280 E501 line too long (x > 79 characters) errors.

Would you prefer pyflakes instead? If so, would you prefer those long lines shortening, or some config adding to ignore E501?

@agronholm
Copy link
Collaborator

I don't understand why we need separate results from pep8 and pyflakes. As for the line width issue, flake8 just needs a setting for that. See this for an example.

@hugovk
Copy link
Contributor Author

hugovk commented Oct 15, 2016

We don't need separate results, it could just makes it a bit easier to understand which is which and why they're different.

Anyway, I'll added that to the config. Sevently-odd lines are up to 250 chars long, shall I shorten them?

@agronholm
Copy link
Collaborator

Yes, please do.

@agronholm
Copy link
Collaborator

BTW, the 99 character limit I use in my own projects is the maximum permitted by PEP 8, so I figured we could use the same limit here too.

@agronholm
Copy link
Collaborator

Looking pretty good already. The various "pip install" commands in .travis.yml could be joined as one. Other than that I have no other requests.

@agronholm
Copy link
Collaborator

If you'll just combine the pip installs in .travis.yml to one line, then I'm ready to merge.

@hugovk
Copy link
Contributor Author

hugovk commented Oct 17, 2016

Done.

In general, a benefit of having separate lines for pip install is Travis CI will show how long each line takes, which can be useful when some of them take a long time and you want to optimise the build. But coverage and tox-travis take 1.7s and 1s on Python 2.7, and 5.3s and 2.7s on PyPy, so doesn't matter too much.

I've also left pip install coveralls in the after_success: section, because we only need coveralls for success; there's no point installing it otherwise.

Finally, I've added some extra tests cases that increase coverage to 99%.

@agronholm agronholm merged commit 73ac260 into jaraco:master Oct 17, 2016
@agronholm
Copy link
Collaborator

Good enough for me. Thanks!

@hugovk hugovk deleted the travisci branch October 17, 2016 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants