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

Fix logic in buildbot.status.builder:BuilderStatus.matchesAnyTag #1576

Merged
merged 5 commits into from Mar 14, 2015

Conversation

adiroiban
Copy link
Contributor

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!

@adiroiban
Copy link
Contributor Author

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

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

@tardyp
Copy link
Member

tardyp commented Mar 4, 2015

good catch!

Return False when requested tags don't match.
"""
sut = self.makeBuilderStatus()
sut.tags = {'one'}
Copy link
Member

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

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

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!

@sa2ajj
Copy link
Contributor

sa2ajj commented Mar 10, 2015

LGTM

@sa2ajj sa2ajj added this to the eight milestone Mar 10, 2015
sa2ajj pushed a commit that referenced this pull request Mar 14, 2015
Fix logic in buildbot.status.builder:BuilderStatus.matchesAnyTag
@sa2ajj sa2ajj merged commit 3a0a1f9 into buildbot:eight Mar 14, 2015
@sa2ajj
Copy link
Contributor

sa2ajj commented Mar 14, 2015

Thank you, @adiroiban

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants