Skip to content

Commit

Permalink
merging PR Chaosthebot#503: Fix ci failed label
Browse files Browse the repository at this point in the history
Chaosthebot#503: Fix ci failed label

Description:
Currently it gets added then removed as soon as a PR is created. That's because the current code sees pending (Travis is still running) as failing.

:white_check_mark: PR passed with a vote of 11 for and 0 against, a weighted total of 11.0 and a threshold of 6.5, and a current meritocracy review.

Vote record:
@PlasmaPower: 1
@Swizz: 1
@amoffat: 1
@andrewda: 1
@anythingbot: 1
@e-beach: 1
@ike709: 1
@JustynC7: 1
@mark-i-m: 1
@rhengles: 1
@rudehn: 1
  • Loading branch information
PlasmaPower authored and chaosbot committed Jun 4, 2017
1 parent 90b7dd2 commit 3f21ec8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion github_api/prs.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def has_build_failed(api, urn, ref):
statuses = get_commit_statuses(api, urn, ref)

for status in statuses:
if status["state"] in ["failure", "pending"] and \
if status["state"] in ["failure", "error"] and \
status["context"].startswith(TRAVIS_CI_CONTEXT):
return True
return False
Expand Down
8 changes: 4 additions & 4 deletions tests/github_api/prs_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def test_statuses_returns_passed_travis_build(self):
self.assertTrue(prs.has_build_passed(self.api, "urn", "ref"))
self.api.assert_called_once_with("get", "/repos/urn/commits/ref/status")
self.api.reset_mock()
# Status returned success for travis - we know for sure it haven't failed
# Status returned success for travis - we know for sure it hasn't failed
self.assertFalse(prs.has_build_failed(self.api, "urn", "ref"))
self.api.assert_called_once_with("get", "/repos/urn/commits/ref/status")
self.api.reset_mock()
Expand All @@ -76,17 +76,17 @@ def test_statuses_returns_failed_travis_build(self):
[{"state": "failure",
"context": "continuous-integration/travis-ci/pr"}],
# Travis pending
[{"state": "pending",
[{"state": "error",
"context": "continuous-integration/travis-ci/pr"}]
]

for statuses in test_data:
self.api.return_value = {"statuses": statuses}
# Status returned failure or pending for travis - we know for sure it haven't suceeded
# Status returned failure or error for travis - we know for sure it hasn't suceeded
self.assertFalse(prs.has_build_passed(self.api, "urn", "ref"))
self.api.assert_called_once_with("get", "/repos/urn/commits/ref/status")
self.api.reset_mock()
# Status returned failure or pending for travis - we know for sure it failed
# Status returned failure or error for travis - we know for sure it failed
self.assertTrue(prs.has_build_failed(self.api, "urn", "ref"))
self.api.assert_called_once_with("get", "/repos/urn/commits/ref/status")
self.api.reset_mock()
Expand Down

0 comments on commit 3f21ec8

Please sign in to comment.