Skip to content

sort all lists obtained via glob.glob, since they are in arbitrary order#1187

Merged
boegel merged 1 commit intoeasybuilders:developfrom
boegel:sorted_globs
Feb 21, 2015
Merged

sort all lists obtained via glob.glob, since they are in arbitrary order#1187
boegel merged 1 commit intoeasybuilders:developfrom
boegel:sorted_globs

Conversation

@boegel
Copy link
Copy Markdown
Member

@boegel boegel commented Feb 21, 2015

ran into this issue on one particular system:

$ python -m test.framework.config
F......
======================================================================
FAIL: test_XDG_CONFIG_env_vars (__main__.EasyBuildConfigTest)
Test effect of XDG_CONFIG* environment variables on default configuration.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/users/k/kehoste/test/easybuild-framework-robust_unit_tests/test/framework/config.py", line 383, in test_XDG_CONFIG_env_vars
    self.assertEqual(eb_go.options.configfiles, cfg_files)
AssertionError: Lists differ: ['/users/k/kehoste/tmpdir/tmpY... != ['/users/k/kehoste/tmpdir/tmpY...

First differing element 0:
/users/k/kehoste/tmpdir/tmpY0uicG/dir1/easybuild.d/foo.cfg
/users/k/kehoste/tmpdir/tmpY0uicG/dir1/easybuild.d/bar.cfg

- ['/users/k/kehoste/tmpdir/tmpY0uicG/dir1/easybuild.d/foo.cfg',
-  '/users/k/kehoste/tmpdir/tmpY0uicG/dir1/easybuild.d/bar.cfg',
? ^

+ ['/users/k/kehoste/tmpdir/tmpY0uicG/dir1/easybuild.d/bar.cfg',
? ^

+  '/users/k/kehoste/tmpdir/tmpY0uicG/dir1/easybuild.d/foo.cfg',
   '/users/k/kehoste/tmpdir/tmpY0uicG/homedir/.config/easybuild/config.cfg']

----------------------------------------------------------------------
Ran 7 tests in 4.412s

FAILED (failures=1)

the list of default system config files is obtained via glob.glob, which apparently returns a list in arbitrary order (cfr. http://stackoverflow.com/questions/6773584/how-is-pythons-glob-glob-ordered)

hence: sort all lists obtained via glob.glob to avoid surprises

@wpoely86
Copy link
Copy Markdown
Member

looks fine

@hpcugentbot
Copy link
Copy Markdown

Refer to this link for build results (access rights to CI server needed):
https://jenkins1.ugent.be/job/easybuild-framework-pr-builder/1404/
Test PASSed.

@boegel
Copy link
Copy Markdown
Member Author

boegel commented Feb 21, 2015

Thanks for the review @wpoely86!

boegel added a commit that referenced this pull request Feb 21, 2015
sort all lists obtained via glob.glob, since they are in arbitrary order
@boegel boegel merged commit 110dcf8 into easybuilders:develop Feb 21, 2015
@boegel boegel deleted the sorted_globs branch February 21, 2015 20:20
@stdweird
Copy link
Copy Markdown
Contributor

@boegel nice catch!

@boegel
Copy link
Copy Markdown
Member Author

boegel commented Feb 23, 2015

took me a while to figure out why that particular test was failing on one system, but not on another...

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