Consolidate approved policies and add local lease, document CAS, commit, candidate and environment gates. Preserve conservative recovery and cleanup limits.
26 lines
1.3 KiB
Python
26 lines
1.3 KiB
Python
"""Expected top-level tests must actually run and pass, not merely exit zero."""
|
|
import importlib.util
|
|
from pathlib import Path
|
|
import unittest
|
|
|
|
class TestEvidence(unittest.TestCase):
|
|
def checker(self):
|
|
path = Path(__file__).resolve().parents[1] / 'verify_go_test_evidence.py'
|
|
spec = importlib.util.spec_from_file_location('test_evidence_checker', path)
|
|
module = importlib.util.module_from_spec(spec)
|
|
spec.loader.exec_module(module)
|
|
return module.verify
|
|
|
|
def test_both_expected_tests_pass(self):
|
|
self.assertTrue(self.checker()('--- PASS: TestA (0.10s)\n--- PASS: TestB (2.00s)\n', ['TestA', 'TestB'])['passed'])
|
|
|
|
def test_missing_partial_skip_failure_and_duplicate_are_not_pass(self):
|
|
for text in ['', '--- PASS: TestA (1s)\n', '--- PASS: TestA (1s)\n--- SKIP: TestB (0s)\n',
|
|
'--- PASS: TestA (1s)\n--- FAIL: TestB (1s)\n',
|
|
'--- PASS: TestA (1s)\n--- PASS: TestB (1s)\n--- PASS: TestB (1s)\n']:
|
|
with self.subTest(text=text):
|
|
self.assertFalse(self.checker()(text, ['TestA', 'TestB'])['passed'])
|
|
|
|
def test_subtests_and_case_mismatches_do_not_prove_parent_execution(self):
|
|
self.assertFalse(self.checker()(' --- PASS: TestPiAgent/child (1s)\n--- PASS: TestPIAgent (1s)\n', ['TestPiAgent'])['passed'])
|