diff options
| author | Silent <103598001+SebSilent@users.noreply.github.com> | 2026-11-22 22:58:17 -0300 |
|---|---|---|
| committer | Silent <103598001+SebSilent@users.noreply.github.com> | 2026-11-22 22:58:17 -0300 |
| commit | 9fc6b263e459526f6646855a0444d95ecf9bbe21 (patch) | |
| tree | 6461da3bc68b407ba5697015c1daa9f1b703e992 /tests/test_progress_dashboard.py | |
| parent | 03b09a086592a197db64d91655c6e65c30764d96 (diff) | |
progress_dashboard: fail on an unlistable sub-folder instead of a partial test selection or code digest
Diffstat (limited to 'tests/test_progress_dashboard.py')
| -rw-r--r-- | tests/test_progress_dashboard.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_progress_dashboard.py b/tests/test_progress_dashboard.py index dfa5e8e9c..caf1c7b3e 100644 --- a/tests/test_progress_dashboard.py +++ b/tests/test_progress_dashboard.py | |||
| @@ -11,6 +11,7 @@ import subprocess | |||
| 11 | import sys | 11 | import sys |
| 12 | import tempfile | 12 | import tempfile |
| 13 | import unittest | 13 | import unittest |
| 14 | from unittest import mock | ||
| 14 | 15 | ||
| 15 | HERE = os.path.dirname(os.path.abspath(__file__)) | 16 | HERE = os.path.dirname(os.path.abspath(__file__)) |
| 16 | ROOT = os.path.dirname(HERE) | 17 | ROOT = os.path.dirname(HERE) |
| @@ -82,6 +83,21 @@ class Tests(unittest.TestCase): | |||
| 82 | self.assertIn("__main__", text) | 83 | self.assertIn("__main__", text) |
| 83 | self.assertIsNone(pd.PYTEST_MARKERS.search(text)) | 84 | self.assertIsNone(pd.PYTEST_MARKERS.search(text)) |
| 84 | 85 | ||
| 86 | def test_unlistable_subfolder_raises_instead_of_a_partial_scan(self): | ||
| 87 | # os.walk skips a directory it cannot list unless onerror raises; the selection and the digest | ||
| 88 | # used to silently drop the sub-folder and report the rest as complete. | ||
| 89 | def walk(top, onerror=None, **kwargs): | ||
| 90 | if onerror is not None: | ||
| 91 | onerror(PermissionError(13, "Permission denied", os.path.join(top, "locked"))) | ||
| 92 | return | ||
| 93 | yield # pragma: no cover | ||
| 94 | |||
| 95 | with mock.patch.object(pd.os, "walk", side_effect=walk): | ||
| 96 | with self.assertRaises(PermissionError): | ||
| 97 | pd.ci_test_files() | ||
| 98 | with self.assertRaises(PermissionError): | ||
| 99 | pd.code_digest() | ||
| 100 | |||
| 85 | 101 | ||
| 86 | class Freshness(unittest.TestCase): | 102 | class Freshness(unittest.TestCase): |
| 87 | def collect(self, results): | 103 | def collect(self, results): |