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

Introduce function ensure_iterable_license_specs #2157

Merged
merged 4 commits into from Mar 22, 2017

Conversation

geimer
Copy link
Contributor

@geimer geimer commented Mar 10, 2017

...as a result of refactoring easybuilders/easybuild-easyblocks#1129

elif isinstance(specs, basestring):
license_specs = [specs]
elif isinstance(specs, (list, tuple)) and all(isinstance(x, basestring) for x in specs):
license_specs = specs
Copy link
Member

Choose a reason for hiding this comment

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

I would ensure a consistent return type here, either a list of a tuple...

To ensure a list, use list(specs) here.

To ensure a tuple, use tuple(specs) here and (None,) and (specs,) above.

@boegel
Copy link
Member

boegel commented Mar 10, 2017

@geimer You forgot the commit for the unit test for the new function. ;-)

@boegel boegel added this to the 3.2.0 milestone Mar 10, 2017
@geimer
Copy link
Contributor Author

geimer commented Mar 10, 2017

@boegel I only have two hands and a single keyboard, so my multi-threading capabilities are limited ;-)
Will follow-up after lunch...

self.assertEqual(ensure_iterable_license_specs('foo'), ['foo'])
self.assertEqual(ensure_iterable_license_specs(['foo']), ['foo'])
self.assertEqual(ensure_iterable_license_specs(['foo', 'bar']), ['foo', 'bar'])
self.assertEqual(ensure_iterable_license_specs(('foo')), ['foo'])
Copy link
Member

Choose a reason for hiding this comment

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

if you want to test with a single-element tuple, use ('foo',) rather than ('foo') (which is identical to 'foo'

self.assertErrorRegex(EasyBuildError, error_msg, ensure_iterable_license_specs, [42, 'foo'])
self.assertErrorRegex(EasyBuildError, error_msg, ensure_iterable_license_specs, [['foo']])
self.assertErrorRegex(EasyBuildError, error_msg, ensure_iterable_license_specs, [(42, 'foo')])
self.assertErrorRegex(EasyBuildError, error_msg, ensure_iterable_license_specs, (42))
Copy link
Member

Choose a reason for hiding this comment

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

(42,)

@geimer
Copy link
Contributor Author

geimer commented Mar 10, 2017

@boegel Travis doesn't seem to pick up the last commit. What was the trick again?

@boegel
Copy link
Member

boegel commented Mar 10, 2017

@geimer close/open the PR, but other (more recent) PRs (cfr. #2159) are also having the same issue, seems like Travis (or GitHub) are experiencing some problems, so we'll have to give it some time, I think...

@boegel
Copy link
Member

boegel commented Mar 10, 2017

(close/open to wake up Travis)

@boegel boegel closed this Mar 10, 2017
@boegel boegel reopened this Mar 10, 2017
@boegel
Copy link
Member

boegel commented Mar 11, 2017

@geimer This is good to go, but I'll hold off merging it into develop until EasyBuild v3.1.2 is release (which is a bugfix only release), cfr. https://github.com/hpcugent/easybuild-framework/milestone/45

@boegel
Copy link
Member

boegel commented Mar 22, 2017

Going in, thanks @geimer!

@boegel boegel merged commit bca9c20 into easybuilders:develop Mar 22, 2017
@geimer geimer deleted the ensure_iterable_license_specs branch March 24, 2017 08:12
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.

None yet

2 participants