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:
authorLeonardo Guimaraes <leozinhoszg@gmail.com>2026-11-22 16:52:03 -0300
committerLeonardo Guimaraes <leozinhoszg@gmail.com>2026-11-22 16:52:03 -0300
commitb4a2e05585634214d99b61ba602d1f1c57bb0fc3 (patch)
tree740be96169e5a7387325dd491bca1f5ee0ccf8b9 /tests/test_progress_dashboard.py
parent8915df896e10c0cef994ce390a490fbc57f21d23 (diff)
progress_dashboard: no file name from outside the repository on the page
scrub() kept the last component of every absolute path, so a failing test line naming a carved shader in the work folder showed the shader's name. A path inside the repository now becomes its relative path and any other path becomes <path>, file name included; URLs and relative paths are left alone. The corpus test checked components, sources and metrics only, so a name added to notes (which the page prints) passed. It now checks everything the collector holds. Both cases were found by JRamos1993 in review; each new check fails when the old behaviour is put back.
Diffstat (limited to 'tests/test_progress_dashboard.py')
-rw-r--r--tests/test_progress_dashboard.py26
1 files changed, 24 insertions, 2 deletions
diff --git a/tests/test_progress_dashboard.py b/tests/test_progress_dashboard.py
index f1f858a56..dfa5e8e9c 100644
--- a/tests/test_progress_dashboard.py
+++ b/tests/test_progress_dashboard.py
@@ -204,8 +204,30 @@ class Corpus(unittest.TestCase):
204 ("compute", "implemented"): 1, ("compute", "failed"): 1}) 204 ("compute", "implemented"): 1, ("compute", "failed"): 1})
205 m = next(m for m in col.metrics if m["id"] == "corpus.validated") 205 m = next(m for m in col.metrics if m["id"] == "corpus.validated")
206 self.assertEqual((m["numerator"], m["denominator"]), (2, 5)) 206 self.assertEqual((m["numerator"], m["denominator"]), (2, 5))
207 self.assertNotIn(SENTINEL, json.dumps({"c": col.components, "s": col.sources, "m": col.metrics})) 207 # everything the collector holds can reach the page (notes and panels included), so check all of it
208 self.assertNotIn(tmp, json.dumps(col.sources)) 208 held = json.dumps(vars(col), default=str)
209 self.assertNotIn(SENTINEL, held)
210 self.assertNotIn(tmp, held)
211 self.assertNotIn(json.dumps(tmp)[1:-1], held)
212
213
214class Scrub(unittest.TestCase):
215 def test_paths_outside_the_repository_lose_their_file_name(self):
216 sep = os.sep
217 work = os.path.join(tempfile.gettempdir(), "work", "shaders", "dxbc", f"{SENTINEL}.fssm")
218 self.assertEqual(pd.scrub(f"FAIL: cannot read {work}"), "FAIL: cannot read <path>")
219 self.assertEqual(pd.scrub(f"see /home/someone/work/{SENTINEL}.fssm now"), "see <path> now")
220 self.assertEqual(pd.scrub("in " + os.path.join(pd.HOME, "work", f"{SENTINEL}.fssm")), "in <path>")
221 self.assertEqual(pd.scrub(f"C:{sep}work{sep}{SENTINEL}_a.fssm, C:{sep}{SENTINEL}_b.fssm"), "<path> <path>")
222
223 def test_paths_inside_the_repository_become_relative(self):
224 line = "Error: " + os.path.join(ROOT, "tools", "text_tables.py") + " line 3"
225 self.assertEqual(pd.scrub(line), "Error: tools/text_tables.py line 3")
226
227 def test_urls_and_relative_paths_stay(self):
228 self.assertEqual(pd.scrub("see https://github.com/ItsNotRexed/Leonida/issues/1"),
229 "see https://github.com/ItsNotRexed/Leonida/issues/1")
230 self.assertEqual(pd.scrub("tests/test_x.py failed"), "tests/test_x.py failed")
209 231
210 232
211class Outputs(unittest.TestCase): 233class Outputs(unittest.TestCase):