upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/tests/test_progress_dashboard.py
diff options
context:
space:
mode:
authortedin7 <tommasoderosa94@gmail.com>2026-11-23 02:28:32 +0100
committertedin7 <tommasoderosa94@gmail.com>2026-11-23 02:28:32 +0100
commit372cf42ec2fc3f482fe33b16cec9d09313d4759d (patch)
tree6f5fb3a3c280074215e429e48b79efe5109deef1 /tests/test_progress_dashboard.py
parent03b09a086592a197db64d91655c6e65c30764d96 (diff)
progress_dashboard: count merged D3D- items from merged PR titles (BUILD-1283)
Diffstat (limited to 'tests/test_progress_dashboard.py')
-rw-r--r--tests/test_progress_dashboard.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/tests/test_progress_dashboard.py b/tests/test_progress_dashboard.py
index dfa5e8e9c..e4e523a6b 100644
--- a/tests/test_progress_dashboard.py
+++ b/tests/test_progress_dashboard.py
@@ -3,7 +3,7 @@
3 python -I tests/test_progress_dashboard.py 3 python -I tests/test_progress_dashboard.py
4 4
5Every input is written here by hand (Markdown tables, JUnit XML, a CTest log, a fake work folder whose shader names 5Every input is written here by hand (Markdown tables, JUnit XML, a CTest log, a fake work folder whose shader names
6are sentinels). No game files, no GPU, no network: the GitHub path is exercised through its parsers only. 6are sentinels). No game files, no GPU, no network: the GitHub path is fed synthetic gh output.
7""" 7"""
8import json 8import json
9import os 9import os
@@ -11,6 +11,7 @@ import subprocess
11import sys 11import sys
12import tempfile 12import tempfile
13import unittest 13import unittest
14from unittest import mock
14 15
15HERE = os.path.dirname(os.path.abspath(__file__)) 16HERE = os.path.dirname(os.path.abspath(__file__))
16ROOT = os.path.dirname(HERE) 17ROOT = os.path.dirname(HERE)
@@ -164,6 +165,26 @@ class Github(unittest.TestCase):
164 self.assertEqual(pd.item_ids("hash with SHA-256, write UTF-8, read OPTIONS2-1 and D3D12-3"), []) 165 self.assertEqual(pd.item_ids("hash with SHA-256, write UTF-8, read OPTIONS2-1 and D3D12-3"), [])
165 self.assertEqual(pd.item_ids(None), []) 166 self.assertEqual(pd.item_ids(None), [])
166 167
168 def test_d3d_metric_counts_merged_pull_requests_not_only_table_rows(self):
169 body = ("| ID | Title | Owner | PR | Status |\n|---|---|---|---|---|\n"
170 "| D3D-1 | a | @a | #50 | PR open |\n| D3D-2 | b | @b | #51 | PR open |\n")
171 merged = [{"number": n, "title": f"D3D-{n}: x", "mergedAt": "2026-11-22T10:00:00Z", "author": {"login": "x"}}
172 for n in (10, 11, 12)]
173 open_prs = [{"number": 50, "title": "D3D-1: a", "isDraft": False, "author": {"login": "x"}},
174 {"number": 51, "title": "D3D-2: b", "isDraft": False, "author": {"login": "x"}}]
175
176 def fake_gh(args, timeout=60):
177 if args[:2] == ["pr", "list"]:
178 return merged if "merged" in args else open_prs
179 if args[:2] == ["issue", "view"]:
180 return {"body": body, "updatedAt": "2026-11-22T00:00:00Z"}
181 return []
182 col = pd.Collector()
183 with mock.patch.object(pd, "gh_json", fake_gh), mock.patch.object(pd.shutil, "which", lambda _: "/usr/bin/gh"):
184 pd.collect_github(col, "o/r", "me")
185 m = next(m for m in col.metrics if m["id"] == "d3d12.merged")
186 self.assertEqual((m["numerator"], m["denominator"]), (3, 5))
187
167 def test_merged_pull_requests_are_implemented(self): 188 def test_merged_pull_requests_are_implemented(self):
168 merged = [{"number": 10, "title": "D3D-1: a", "mergedAt": "2026-11-22T10:00:00Z", "author": {"login": "x"}}, 189 merged = [{"number": 10, "title": "D3D-1: a", "mergedAt": "2026-11-22T10:00:00Z", "author": {"login": "x"}},
169 {"number": 12, "title": "docs: b", "mergedAt": "2026-11-22T12:00:00Z", "author": {"login": "y"}}] 190 {"number": 12, "title": "docs: b", "mergedAt": "2026-11-22T12:00:00Z", "author": {"login": "y"}}]