@@ -41,18 +41,16 @@ def __init__(
4141 self .gh_issue = gh_issue .GHIssue (number = self .issue , repo = self .repo )
4242
4343 self .is_blocked : tp .Callable [[], bool ]
44- if self .repo == "IntersectMBO/cardano-node" :
45- self .is_blocked = self ._node_issue_is_blocked
46- elif self .repo == "IntersectMBO/cardano-cli" :
44+ if self .repo == "IntersectMBO/cardano-cli" :
4745 self .is_blocked = self ._cli_issue_is_blocked
4846 elif self .repo == "IntersectMBO/cardano-db-sync" :
4947 self .is_blocked = self ._dbsync_issue_is_blocked
5048 else :
5149 self .is_blocked = self ._issue_is_blocked
5250
53- def _node_issue_is_blocked (self ) -> bool :
54- """Check if node issue is blocked."""
55- # Assume that the issue is blocked if no Github token was provided and so the check
51+ def _issue_blocked_in_version (self , product_version : version . Version ) -> bool :
52+ """Check if an issue is blocked in given product version ."""
53+ # Assume that the issue is blocked if no GitHub token was provided and so the check
5654 # cannot be performed.
5755 if not self .gh_issue .TOKEN :
5856 LOGGER .warning (
@@ -65,78 +63,24 @@ def _node_issue_is_blocked(self) -> bool:
6563 if not self .gh_issue .is_closed ():
6664 return True
6765
68- # The issue is blocked if it was fixed in a node version that is greater than
69- # the node version we are currently running.
70- if self .fixed_in and version .parse (self .fixed_in ) > VERSIONS . node : # noqa:SIM103
66+ # The issue is blocked if it was fixed or integrated into a product version that is greater
67+ # than the product version we are currently running.
68+ if self .fixed_in and version .parse (self .fixed_in ) > product_version : # noqa:SIM103
7169 return True
7270
7371 return False
7472
7573 def _cli_issue_is_blocked (self ) -> bool :
76- """Check if generic issue is blocked."""
77- # Assume that the issue is blocked if no Github token was provided and so the check
78- # cannot be performed.
79- if not self .gh_issue .TOKEN :
80- LOGGER .warning (
81- "No GitHub token provided, cannot check if issue '%s' is blocked" ,
82- f"{ self .repo } #{ self .issue } " ,
83- )
84- return True
85-
86- # The issue is blocked if it is was not closed yet
87- if not self .gh_issue .is_closed ():
88- return True
89-
90- # The issue is blocked if it was fixed in a cli version that is greater than
91- # the cli version we are currently running.
92- if self .fixed_in and version .parse (self .fixed_in ) > VERSIONS .cli : # noqa:SIM103
93- return True
94-
95- return False
74+ """Check if cardano-cli issue is blocked."""
75+ return self ._issue_blocked_in_version (VERSIONS .cli )
9676
9777 def _dbsync_issue_is_blocked (self ) -> bool :
9878 """Check if dbsync issue is blocked."""
99- # Assume that the issue is blocked if no Github token was provided and so the check
100- # cannot be performed.
101- if not self .gh_issue .TOKEN :
102- LOGGER .warning (
103- "No GitHub token provided, cannot check if issue '%s' is blocked" ,
104- f"{ self .repo } #{ self .issue } " ,
105- )
106- return True
107-
108- # The issue is blocked if it is was not closed yet
109- if not self .gh_issue .is_closed ():
110- return True
111-
112- # The issue is blocked if it was fixed in a dbsync version that is greater than
113- # the dbsync version we are currently running.
114- if self .fixed_in and version .parse (self .fixed_in ) > VERSIONS .dbsync : # noqa:SIM103
115- return True
116-
117- return False
79+ return self ._issue_blocked_in_version (VERSIONS .dbsync )
11880
11981 def _issue_is_blocked (self ) -> bool :
120- """Check if generic issue is blocked."""
121- # Assume that the issue is blocked if no Github token was provided and so the check
122- # cannot be performed.
123- if not self .gh_issue .TOKEN :
124- LOGGER .warning (
125- "No GitHub token provided, cannot check if issue '%s' is blocked" ,
126- f"{ self .repo } #{ self .issue } " ,
127- )
128- return True
129-
130- # The issue is blocked if it is was not closed yet
131- if not self .gh_issue .is_closed ():
132- return True
133-
134- # The issue is blocked if the fix was integrated into a node version that is greater than
135- # the node version we are currently running.
136- if self .fixed_in and version .parse (self .fixed_in ) > VERSIONS .node : # noqa:SIM103
137- return True
138-
139- return False
82+ """Check if an issue is blocked."""
83+ return self ._issue_blocked_in_version (VERSIONS .node )
14084
14185 def finish_test (self ) -> None :
14286 """Fail or Xfail test with GitHub issue reference."""
0 commit comments