Skip to content

Commit 5742bca

Browse files
authored
Fix clean up file (pyccel#1954)
The clean up file still does not quite use the test keys correctly. This PR should fix it
1 parent b771c20 commit 5742bca

File tree

1 file changed

+27
-9
lines changed

1 file changed

+27
-9
lines changed

ci_tools/bot_clean_up.py

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,30 @@
33
import json
44
import os
55
import sys
6-
from bot_tools.bot_funcs import Bot, test_dependencies, pr_test_keys as bot_pr_test_keys
6+
from bot_tools.bot_funcs import Bot, test_dependencies, pr_test_keys as bot_pr_test_keys, default_python_versions
77

8-
pr_test_keys = list(bot_pr_test_keys) + ['Codacy']
8+
pr_test_keys = [(t, default_python_versions[t]) for t in bot_pr_test_keys] + ['Codacy']
9+
10+
def get_name_from_key(name_key):
11+
"""
12+
Get the name from a name key by dropping the information about the Python version.
13+
14+
Get the name from a name key by dropping the information about the Python version.
15+
16+
Parameters
17+
----------
18+
name_key : str | tuple
19+
The key used to uniquely identify the run configuration.
20+
21+
Returns
22+
-------
23+
str
24+
A string indicating the run tool (but not the Python version).
25+
"""
26+
if isinstance(name_key, tuple):
27+
# Ignore Python version
28+
return name_key[0]
29+
return name_key
930

1031
if __name__ == '__main__':
1132
# Parse event payload from $GITHUB_EVENT_PATH variable
@@ -15,7 +36,7 @@
1536
with open(os.environ["GITHUB_EVENT_PATH"], encoding="utf-8") as event_file:
1637
event = json.load(event_file)
1738

18-
name = event['check_run']['name']
39+
full_name = event['check_run']['name']
1940

2041
print(event)
2142

@@ -30,10 +51,7 @@
3051
except StopIteration:
3152
pr_id = 0
3253

33-
name_key = bot.get_name_key(name)
34-
if isinstance(name_key, tuple):
35-
# Ignore Python version
36-
name_key = name_key[0]
54+
name = get_name_from_key(bot.get_name_key(full_name))
3755

3856
runs = bot.get_check_runs()
3957

@@ -54,8 +72,8 @@
5472
# Not a Pyccel triggered test
5573
continue
5674
deps = test_dependencies.get(q_key[0], ())
57-
if name_key in deps:
58-
if all(d in successful_runs for d in deps):
75+
if name in deps:
76+
if all(d in (get_name_from_key(r) for r in successful_runs) for d in deps):
5977
q_name, python_version = q_key
6078
workflow_ids = None
6179
if q_name == 'coverage':

0 commit comments

Comments
 (0)