Skip to content

Commit

Permalink
Test new fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
miri64 committed Jan 17, 2023
1 parent ec75ea9 commit 6b37837
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions check_labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,11 @@ def test_get_pull_no_invalid():
with pytest.raises(ValueError):
get_pull_no("foobar")

def test_get_pull_from_env(monkeypatch):
monkeypatch.setitem(os.environ, "INPUT_PULL_REQUEST", "59706")
assert get_pull_no("refs/pull/12345/head") == 12345
assert get_pull_no("foobar") == 59706

@pytest.mark.parametrize(
"value",
["foobar", "foobar>3>test"],
Expand Down Expand Up @@ -378,8 +383,13 @@ def add_to_labels(self, label):
self.labels = [label]

def remove_from_labels(self, label):
if self.labels and label in self.labels:
self.labels.remove(label)
if self.labels is not None:
try:
self.labels.remove(label)
except ValueError as exc:
raise github.GithubException(
status=404, data={"message": str(exc)}
) from exc

def get_labels(self):
for label in self.labels:
Expand Down

0 comments on commit 6b37837

Please sign in to comment.