diff options
Diffstat (limited to 'tests/test_progress_dashboard.py')
| -rw-r--r-- | tests/test_progress_dashboard.py | 26 |
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 | |||
| 214 | class 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 | ||
| 211 | class Outputs(unittest.TestCase): | 233 | class Outputs(unittest.TestCase): |