Skip to content

Conversation

@wpoely86
Copy link
Member

No description provided.

@wpoely86
Copy link
Member Author

The first Jenkins test should fail.

@hpcugentbot
Copy link

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.

@boegel boegel added this to the v2.7.0 milestone Feb 17, 2016
# 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):
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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...

@boegel
Copy link
Member

boegel commented Feb 17, 2016

@wpoely86: it fails, hooray! Now fix it? ;)

@hpcugentbot
Copy link

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.

@hpcugentbot
Copy link

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.

@boegel
Copy link
Member

boegel commented Feb 24, 2016

Jenkins: test this please

@hpcugentbot
Copy link

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.

@hpcugentbot
Copy link

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
  ...
@hpcugentbot
Copy link

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)
Copy link
Member

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 :))

@boegel boegel removed this from the v3.0 milestone Nov 10, 2016
@boegel
Copy link
Member

boegel commented Nov 24, 2016

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

@wpoely86
Copy link
Member Author

Why? We are replying on pep8 and pylint? I think style is something which we want to control ourself?

@boegel
Copy link
Member

boegel commented Nov 24, 2016

@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 custompylintrc, and it integrates well with Travis (see for example apptainer/singularity#341)

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).

@wpoely86
Copy link
Member Author

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()
  ...
# self.assertTrue(False, "pep8 not available")
# else:
# print "Skipping style checks (no pep8 available)"
# return
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wpoely86 please remove this


def suite():
"""Return all style tests for easyconfigs."""
return TestLoader().loadTestsFromTestCase(StyleTest)
Copy link
Member

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



if __name__ == '__main__':
main()
Copy link
Member

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

# return

# all available easyconfig files
test_easyconfigs_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'easyconfigs')
Copy link
Member

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
Copy link
Member

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):
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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.

Copy link
Member Author

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

Copy link
Member

@boegel boegel Nov 29, 2016

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
Copy link
Member

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')
Copy link
Member

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...

Copy link
Member

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

@boegel
Copy link
Member

boegel commented Nov 30, 2016

lgtm, thanks for all the effort on this @wpoely86!

@boegel boegel merged commit 0348836 into easybuilders:develop Nov 30, 2016
@wpoely86 wpoely86 deleted the style branch November 30, 2016 13:56
@wpoely86
Copy link
Member Author

Easyconfig use is in easybuilders/easybuild-easyconfigs#2506

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.

4 participants