-
Notifications
You must be signed in to change notification settings - Fork 218
Add style tests #1618
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 style tests #1618
Conversation
Still fails for the moment.
|
The first Jenkins test should fail. |
|
EasyBuild framework unit test suite FAILed. See https://jenkins1.ugent.be/job/easybuild-framework-pr-builder/2710/console for more details. Please fix the reported issues by pushing additional commits to the branch corresponding with this pull request; contact @boegel if you're not sure what to do. |
| # definied as AXXX where A is either E or W and XXX is a 3 digit number. | ||
| # It should be mentioned in the docstring as a single word. | ||
| # Read the pep8 docs to understand the arguments of these functions | ||
| def eb_check_trailing_whitespace(physical_line, lines, line_number, total_lines): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs @only_if_module_is_available('pep8') too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, this should be a 'private' function. Never ever be called outside this module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, but you still need the guard imho (since it uses pep8)
If you want to make it a private function, rename it to _eb_check...
|
@wpoely86: it fails, hooray! Now fix it? ;) |
|
EasyBuild framework unit test suite FAILed. See https://jenkins1.ugent.be/job/easybuild-framework-pr-builder/2718/console for more details. Please fix the reported issues by pushing additional commits to the branch corresponding with this pull request; contact @boegel if you're not sure what to do. |
|
EasyBuild framework unit test suite FAILed. See https://jenkins1.ugent.be/job/easybuild-framework-pr-builder/2719/console for more details. Please fix the reported issues by pushing additional commits to the branch corresponding with this pull request; contact @boegel if you're not sure what to do. |
|
Jenkins: test this please |
|
EasyBuild framework unit test suite FAILed. See https://jenkins1.ugent.be/job/easybuild-framework-pr-builder/2767/console for more details. Please fix the reported issues by pushing additional commits to the branch corresponding with this pull request; contact @boegel if you're not sure what to do. |
|
EasyBuild framework unit test suite FAILed. See https://jenkins1.ugent.be/job/easybuild-framework-pr-builder/2772/console for more details. Please fix the reported issues by pushing additional commits to the branch corresponding with this pull request; contact @boegel if you're not sure what to do. |
* develop: (58 commits) fix remark make default is_short_modname_for check less strict to support versionless external modules as deps Update toolchain.py loosen up mod exists regex for show output & clean up better docstrings enhance ModulesTool.exist to also recognize partial module names fix remark Hercules foundation is now FWO fix remark fix fetch_easyconfigs_from_pr w.r.t. duplicate files in PRs add Description string also in lua modulefiles trying to fix unit tests removed space change suggested by @geimer trying to fix unit tests correct fix, I hope :) undo previous change fix bug triggered with use of --stop + add test that triggers it very minor style fix rewrite get_toolchain_hierarchy to fix @ocaisa's remarks ...
|
EasyBuild framework unit test suite PASSed (see https://jenkins1.ugent.be/job/easybuild-framework-pr-builder/2775/console for more details). This pull request is now ready for review/testing. Please try and find someone who can tackle this; contact @boegel if you're not sure what to do. |
| except ImportError: | ||
| pass | ||
|
|
||
| _log = fancylogger.getLogger('easyconfig.style', fname=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why add a logger if you're not using it?
(don't remove it, use it below :))
|
I need to get back to this, but rather than cooking up our own approach, we can also rely on an external service that integrates with GitHub, like http://docs.sonarqube.org/display/PLUG/Python+Plugin |
|
Why? We are replying on pep8 and pylint? I think style is something which we want to control ourself? |
|
@wpoely86 as far as I can tell, you can get full control over how you define your code style via SonarQube too, you can supply a custom And it avoids that we have to write & maintain our own stuff (although we still may have to do that for easyconfigs, I'm mostly talking out the actual Python code in framework/easyblocks here). |
|
This PR is only about style testing for easyconfigs? |
* develop: (962 commits) change log.debug to log.info for sanity_check_commands run 'python setup.py sdist' from correct directory make tests more robust against running headless run framework test suite on installation from sdist source tarball to catch packaging issues fix packaging issue with non-Python scripts in easybuild/scripts use setvar in modules.py to define environment variables don't specify modules tool/syntax to use, bootstrap should get it right by itself enable debugging of bootstrap script only emit debug message on module syntax if $EASYBUILD_MODULE_SYNTAX is defined use correct module syntax in bootstrap script if Lmod is not used export env vars to be picked up by bootstrap script re-enable 'eb --version' check after bootstrap export env vars to be picked up by bootstrap script bump version to 3.1.0.dev0 fix remark in v3.0.0 release notes bump version to 3.0.0, update release notes bump version of bootstrap script (missing in easybuilders#1984) bump Lmod test version to 6.6.3 since 6.6.2 was removed, also test against Lmod 7.0 bump Lmod test version to 6.6.3 since 6.6.2 was removed include tmpdir in RPATH filter via tempfile.gettempdir() ...
test/framework/style.py
Outdated
| # self.assertTrue(False, "pep8 not available") | ||
| # else: | ||
| # print "Skipping style checks (no pep8 available)" | ||
| # return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wpoely86 please remove this
test/framework/style.py
Outdated
|
|
||
| def suite(): | ||
| """Return all style tests for easyconfigs.""" | ||
| return TestLoader().loadTestsFromTestCase(StyleTest) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wpoely86 please use return TestLoaderFiltered().loadTestsFromTestCase(StyleTest, sys.argv[1:]) to allow filtering of tests
test/framework/style.py
Outdated
|
|
||
|
|
||
| if __name__ == '__main__': | ||
| main() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
switch to TextTestRunner(verbosity=1).run(suite()), see #1828
test/framework/style.py
Outdated
| # return | ||
|
|
||
| # all available easyconfig files | ||
| test_easyconfigs_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'easyconfigs') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test easyconfigs are in a different place now, see #1970
.travis.yml
Outdated
| - if [ "x$TRAVIS_PYTHON_VERSION" == 'x2.6' ]; then pip install pydot==1.1.0; else pip install pydot; fi | ||
| # optional Python packages for EasyBuild | ||
| - pip install autopep8 GC3Pie python-graph-dot python-hglib PyYAML | ||
| - pip install pep8 autopep8 GC3Pie python-graph-dot python-hglib PyYAML |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style nitpicking: retain alphabetical order
|
|
||
|
|
||
| @only_if_module_is_available('pep8') | ||
| def style_conformance(easyconfigs, verbose=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename to check_easyconfigs_style ?
| """ | ||
| Check the given list of easyconfigs for style | ||
| :param easyconfigs list of file paths to easyconfigs | ||
| :param verbose print our statistics and be verbose about the errors and warning |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing : after name of arguments
| Check the given list of easyconfigs for style | ||
| :param easyconfigs list of file paths to easyconfigs | ||
| :param verbose print our statistics and be verbose about the errors and warning | ||
| :return the number of warnings and errors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing :
| options.ignore = ( | ||
| 'E402', # import not on top | ||
| 'W291', # replaced by W299 | ||
| 'E501', # line too long |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we ignoring E402 and E501? If there's a good reason, please mention why.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E402 because some easyconfigs imported stuff (not on top)
E501 because some easyconfigs have very long lines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
both of them are a valid reason to fail the style check?
|
|
||
| name = 'gzip' | ||
| version = '1.6' # FIXME bug: quotes are required here to make sure this is parsed a a string, not a floating point value | ||
| # FIXME bug: quotes are required here to make sure this is parsed a a string, not a floating point value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wpoely86 please drop this comment, it doesn't make any sense here (it's copy-pasted from the equivalent .yeb easyconfig)
| return | ||
|
|
||
| # all available easyconfig files | ||
| test_easyconfigs_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'easyconfigs', 'test_ecs') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wpoely86 based on the tweaked test easyconfigs, we should probably revert testing only the easyconfigs in test_ecs, and test all test easyconfigs (including the .yeb ones)? I missed that earlier, sorry...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh wait, .yeb easyconfigs aren't going to pass a PEP8 test... :)
so, leave as is
|
lgtm, thanks for all the effort on this @wpoely86! |
|
Easyconfig use is in easybuilders/easybuild-easyconfigs#2506 |
No description provided.