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
Fix logic in buildbot.status.builder:BuilderStatus.matchesAnyTag #1576
Conversation
39fd008
to
e45a64b
Compare
I will look at fixing this for py2.6 |
@@ -337,7 +337,7 @@ def setTags(self, tags): | |||
|
|||
def matchesAnyTag(self, tags): | |||
# Need to guard against None with the "or []". | |||
return set(self.tags or []).isdisjoint(tags) | |||
return not set(self.tags or []).isdisjoint(tags) |
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.
return bool(set(self.tags or []) & set(tags))
good catch! |
Return False when requested tags don't match. | ||
""" | ||
sut = self.makeBuilderStatus() | ||
sut.tags = {'one'} |
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.
Set comprehensions aren't supported in 2.6
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.
true... fixed. Maybe it would be nice to have a tox.ini file or some script to simplify testing on different python version.
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.
There is already one
Le mar. 10 mars 2015 15:20, Adi Roiban notifications@github.com a écrit :
In master/buildbot/test/unit/test_status_builder.py
#1576 (comment):
- def test_matchesAnyTag_no_tags(self):
"""
Return False when builder has no tags.
"""
sut = self.makeBuilderStatus()
self.assertFalse(sut.matchesAnyTag(set()))
self.assertFalse(sut.matchesAnyTag(set(('any-tag', 'tag'))))
- def test_matchesAnyTag_no_match(self):
"""
Return False when requested tags don't match.
"""
sut = self.makeBuilderStatus()
sut.tags = {'one'}
true... fixed. Maybe it would be nice to have a tox.ini file or some
script to simplify testing on different python version.—
Reply to this email directly or view it on GitHub
https://github.com/buildbot/buildbot/pull/1576/files#r26125132.
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.
Ok. It is not working on my system... will send a patch :)
in the end I hope I can use tox to run something like this
$ tox -e py26,py26,py27 buildbot/test/unit/test_status_builder.py
Thanks!
LGTM |
Fix logic in buildbot.status.builder:BuilderStatus.matchesAnyTag
Thank you, @adiroiban |
Problem
I think that current logic for matchesAnyTag is wrong.
Changes
I wrote a few tests and update the code.
How to test
Create builders with tags. Go in web status and click on the tags. You should see only builders with have one of the selected tags.
Let me know if something needs to be changes.
Thanks!