Skip to content

Commit 7358075

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 89e663b commit 7358075

File tree

3 files changed

+19
-10
lines changed

3 files changed

+19
-10
lines changed

coverage_comment/activity.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,21 @@ class Activity(Enum):
1616
POST_COMMENT = "post_comment"
1717
SAVE_COVERAGE_DATA_FILES = "save_coverage_data_files"
1818

19+
1920
class ActivityNotFound(Exception):
2021
pass
2122

23+
2224
class ActivityConfigError(Exception):
2325
pass
2426

25-
def validate_activity(
26-
activity: str
27-
) -> Activity:
27+
28+
def validate_activity(activity: str) -> Activity:
2829
if activity not in [a.value for a in Activity]:
2930
raise ActivityConfigError(f"Invalid activity: {activity}")
3031
return Activity(activity)
3132

33+
3234
def find_activity(
3335
event_name: str,
3436
is_default_branch: bool,

coverage_comment/main.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@ def action(
8585
)
8686
except activity_module.ActivityNotFound:
8787
log.error(
88-
'This action\'s default behavior is to determine the appropriate '
89-
'mode based on the current branch, whether or not it\'s in a pull '
90-
'request, and if that pull request is open or closed. This '
91-
'frequently results in the correct action taking place, but is '
92-
'only a heuristic. If you need more precise control, you should '
88+
"This action's default behavior is to determine the appropriate "
89+
"mode based on the current branch, whether or not it's in a pull "
90+
"request, and if that pull request is open or closed. This "
91+
"frequently results in the correct action taking place, but is "
92+
"only a heuristic. If you need more precise control, you should "
9393
'specify the "ACTIVITY" parameter as described in the documentation.'
9494
)
9595
return 1

tests/unit/test_activity.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import pytest
44

55
from coverage_comment import activity
6-
from coverage_comment.settings import Config
76

87

98
@pytest.mark.parametrize(
@@ -12,7 +11,13 @@
1211
("workflow_run", True, None, False, activity.Activity.POST_COMMENT),
1312
("push", True, None, False, activity.Activity.SAVE_COVERAGE_DATA_FILES),
1413
("push", False, None, False, activity.Activity.PROCESS_PR),
15-
("pull_request", True, "closed", True, activity.Activity.SAVE_COVERAGE_DATA_FILES),
14+
(
15+
"pull_request",
16+
True,
17+
"closed",
18+
True,
19+
activity.Activity.SAVE_COVERAGE_DATA_FILES,
20+
),
1621
("pull_request", True, None, False, activity.Activity.PROCESS_PR),
1722
("pull_request", False, None, False, activity.Activity.PROCESS_PR),
1823
("schedule", False, None, False, activity.Activity.SAVE_COVERAGE_DATA_FILES),
@@ -50,10 +55,12 @@ def test_find_activity_pr_closed_not_merged():
5055
is_pr_merged=False,
5156
)
5257

58+
5359
def test_validate_activity__invalid():
5460
with pytest.raises(activity.ActivityConfigError):
5561
activity.validate_activity("invalid")
5662

63+
5764
def test_validate_activity__valid():
5865
result = activity.validate_activity("process_pr")
5966
assert result == activity.Activity.PROCESS_PR

0 commit comments

Comments
 (0)