diff --git a/tests/test_feature_scan.py b/tests/test_feature_scan.py index d79116f8dc..e2b1473518 100644 --- a/tests/test_feature_scan.py +++ b/tests/test_feature_scan.py @@ -590,6 +590,7 @@ def run_scan(self, shaders, report, *, fail_writes=False): preexec_fn=self.fail_file_writes if fail_writes else None, ) + @unittest.skipIf(os.name == "nt", "preexec_fn, which these two cases need, is POSIX-only") def test_failed_write_keeps_existing_report(self): with tempfile.TemporaryDirectory() as root: shaders = self.make_shaders(root) @@ -604,6 +605,7 @@ def test_failed_write_keeps_existing_report(self): with open(report, "rb") as stream: self.assertEqual(stream.read(), original) + @unittest.skipIf(os.name == "nt", "preexec_fn, which these two cases need, is POSIX-only") def test_failed_write_leaves_no_temporary_file(self): with tempfile.TemporaryDirectory() as root: shaders = self.make_shaders(root) @@ -633,7 +635,12 @@ def test_success_writes_valid_json(self): if __name__ == "__main__": # Every test_* function in the file, in file order, so a new test can't be left out of the script run. raised = run_tests([fn for name, fn in list(globals().items()) if name.startswith("test_") and callable(fn)]) - ok = not failures and not raised + # The class's cases are unittest methods, so the `test_*` scan above cannot see them: without this the script run + # (CI's standard-library job) skips them silently. + class_result = unittest.TextTestRunner(verbosity=0).run( + unittest.defaultTestLoader.loadTestsFromTestCase(FeatureScanAtomicOutputTests)) + class_failed = len(class_result.failures) + len(class_result.errors) + ok = not failures and not raised and not class_failed print(f"test_feature_scan: {'OK' if ok else 'FAILED'} ({failures} failed check{'s' if failures != 1 else ''}, " f"{len(raised)} failed test{'s' if len(raised) != 1 else ''})") sys.exit(0 if ok else 1)