Skip to content

Include PEP8 plugin in test framework #58

Closed

Description

@mdboom

It was suggested by @wkerzendorf that we may want to have a convenient way to test pep8 compliance within our test framework. There is a py.test plugin for this here:

http://pypi.python.org/pypi/pytest-pep8

It does seem configurable so we can turn off some of the more annoying false-positive warnings off if necessary.

Activity

  1. embray commented on Nov 8, 2011

    @embray
    Member

    +1

  2. eteq commented on Nov 9, 2011

    @eteq
    Member

    @jiffyclub - do you think you can take a crack at this (in particular, adding it as an option to the test function)? Also useful might be http://pypi.python.org/pypi/pytest-cov which runs coverage tests.

  3. jiffyclub commented on Nov 9, 2011

    @jiffyclub
    Contributor

    I'll see what can be done as soon as I get a chance.

  4. jiffyclub commented on Nov 9, 2011

    @jiffyclub
    Contributor

    The py.test pep8 checker just uses the pep8 package: http://pypi.python.org/pypi/pep8, so getting this into astropy would mean packaging the py.test pep8 plugin, and the pep8 package itself. It looks like they are both single file modules, so that's not bad, but there could be import issues since the py.test plugin imports pep8. The packaged plugin could theoretically be modified to import a local copy of pep8. This seems a little redundant when you can just use the pep8 script itself.

    Similarly, the py.test coverage plugin requires the coverage package: http://pypi.python.org/pypi/coverage, which is not a simple, single file module. I don't think it would be in any way practical to include this.

    So, given that these py.test plugins are not self-contained do we want to go ahead and try to include them (pep8, anyway)?

  5. reopened this on Nov 9, 2011
  6. mdboom commented on Nov 9, 2011

    @mdboom
    ContributorAuthor

    Oops. Didn't mean to push the close button ;)

  7. embray commented on Nov 9, 2011

    @embray
    Member

    Yeah, github makes it way too easy to do that accidentally. There should at least be a confirmation dialog or something.

  8. eteq commented on Nov 9, 2011

    @eteq
    Member

    Hmm... I see four approaches, then:

    1. Include arguments to the pep8 and coverage plugins, but have the test script try to run them, and if it fails it emits a warnings something like "you don't have the pytest-pep8 plugin. Run pip install pytest-pep8 to make this work"
    2. Package pep8 and pytest-pep8 in extern, along with pytest-coverage, but just have the coverage thing fail if the coverage package is not installed (perhaps with a message like for option 1).
    3. package pep8 and pytest-pep8 in extern and forget about coverage completely.
    4. Just forget about the whole thing

    I have a slight preference for 1, but 2 is ok also.

  9. astrofrog commented on Nov 10, 2011

    @astrofrog
    Member

    I like option 1. It's something that will be useful to such a small handful of users that I don't think we need to clutter up the repository will all the dependencies required for it to work. Checking pep8 compliance should therefore not run by default when doing python setup.py test but should have a special switch, e.g. python setup.py test --pep8 or a separate python setup.py test-pep8.

  10. mdboom commented on Nov 10, 2011

    @mdboom
    ContributorAuthor

    +1 for option #1. There's two use cases here: 1) developers and 2) users. 1) cares about this stuff, 2) just wants to make sure their build/installation is sane.

  11. wkerzendorf commented on Nov 10, 2011

    @wkerzendorf
    Member

    +1 for option 1 as well. I think it would be nice to mention in the development workflow: 'run pep8 before pull-request'

  12. astrofrog commented on Nov 17, 2011

    @astrofrog
    Member

    Can we close this issue since the pull request has been merged?

  13. eteq commented on Nov 17, 2011

    @eteq
    Member

    Huh... odd - it was supposed to be closed when I entered a commit message that said "closes #51", but apparently somehow that part did't make it into the message. But anyway, yes, it's supposed to be closed.

  14. added a commit that references this issue on Jan 23, 2015
  15. added a commit that references this issue on Jan 3, 2023
  16. added a commit that references this issue on Jul 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions