diff --git a/tests/evidence/m11b2d_a1_collect_only.txt b/tests/evidence/m11b2d_a1_collect_only.txt index ffa9c8a..12a7e7e 100644 --- a/tests/evidence/m11b2d_a1_collect_only.txt +++ b/tests/evidence/m11b2d_a1_collect_only.txt @@ -1,5 +1,8 @@ -# CMD: cd modules/world_sync && ./.venv/bin/python -m pytest tests/test_m11b2_single_tx.py --collect-only -q -# DATE: 2026-09-22T21:40:07+08:00 +# CMD: cd modules/world_sync && /d/pipeline/workspaces/0/sdlc_general/modules/world_sync/.venv/bin/python -m pytest tests/test_m11b2_single_tx.py --collect-only -q +# DATE: 2026-09-22T21:48:56+08:00 +# INTERPRETER: /d/pipeline/workspaces/0/sdlc_general/modules/world_sync/.venv/bin/python +# PYTEST_VERSION: pytest 9.1.1 +# PYTHON_VERSION: Python 3.10.12 tests/test_m11b2_single_tx.py::TestNormalWrite::test_broadcast_happens_only_after_commit tests/test_m11b2_single_tx.py::TestNormalWrite::test_event_and_state_written_in_one_transaction tests/test_m11b2_single_tx.py::TestNormalWrite::test_event_row_is_append_only_without_version_backfill @@ -49,5 +52,5 @@ tests/test_m11b2_single_tx.py::TestRetiredContractCases::test_module_level_helpe tests/test_m11b2_single_tx.py::TestRetiredContractCases::test_plan_assembly_is_side_effect_free tests/test_m11b2_single_tx.py::TestRetiredContractCases::test_unserialisable_payload_rejected -48 tests collected in 0.04s +48 tests collected in 0.05s # RC=0 diff --git a/tests/evidence/m11b2d_a1_pytest.txt b/tests/evidence/m11b2d_a1_pytest.txt index e945e8a..19b8d2d 100644 --- a/tests/evidence/m11b2d_a1_pytest.txt +++ b/tests/evidence/m11b2d_a1_pytest.txt @@ -1,5 +1,8 @@ -# CMD: cd modules/world_sync && ./.venv/bin/python -m pytest tests/test_m11b2_single_tx.py -v --tb=short -# DATE: 2026-09-22T21:39:15+08:00 +# CMD: cd modules/world_sync && /d/pipeline/workspaces/0/sdlc_general/modules/world_sync/.venv/bin/python -m pytest tests/test_m11b2_single_tx.py -v --tb=short +# DATE: 2026-09-22T21:48:50+08:00 +# INTERPRETER: /d/pipeline/workspaces/0/sdlc_general/modules/world_sync/.venv/bin/python +# PYTEST_VERSION: pytest 9.1.1 +# PYTHON_VERSION: Python 3.10.12 ============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-9.1.1, pluggy-1.6.0 -- /d/pipeline/workspaces/0/sdlc_general/modules/world_sync/.venv/bin/python cachedir: .pytest_cache @@ -56,5 +59,5 @@ tests/test_m11b2_single_tx.py::TestRetiredContractCases::test_module_level_helpe tests/test_m11b2_single_tx.py::TestRetiredContractCases::test_plan_assembly_is_side_effect_free XFAIL [ 97%] tests/test_m11b2_single_tx.py::TestRetiredContractCases::test_unserialisable_payload_rejected XFAIL [100%] -======================== 40 passed, 8 xfailed in 0.38s ========================= +======================== 40 passed, 8 xfailed in 0.29s ========================= # RC=0 diff --git a/tests/test_m11b2_single_tx.py b/tests/test_m11b2_single_tx.py index 6b94588..e6f2749 100644 --- a/tests/test_m11b2_single_tx.py +++ b/tests/test_m11b2_single_tx.py @@ -174,7 +174,7 @@ class TxCase(unittest.TestCase): def assert_atomic_rollback(self, tail=2): """原子回滚证明:本次事务 BEGIN 后只有 ROLLBACK、没有 COMMIT。""" k = self.kinds() - self.assertEqual(["BEGIN", "ROLLBACK"], k[-tail:]), + self.assertEqual(["BEGIN", "ROLLBACK"], k[-tail:]) self.assertNotIn("COMMIT", k[-tail:]) def counts(self): @@ -613,18 +613,21 @@ class TestValidation(TxCase): class TestLatency(TxCase): def test_p99_under_200ms(self): - samples = [] + results = [] for i in range(100): res = self.apply("ev-l-%d" % i, states=[su(state={"hp": i})]) self.assertTrue(res["ok"]) - samples.append(res["latency_ms"]) + results.append(res) + samples = [r["latency_ms"] for r in results] p50 = percentile(samples, 50) p99 = percentile(samples, 99) print("[M11b-2d latency] n=%d p50=%.3fms p99=%.3fms max=%.3fms" % (len(samples), p50, p99, max(samples))) self.assertLessEqual(p99, 200.0) self.assertEqual(100, self.eng.count(EVENT_TABLE)) - self.assertFalse(any(r["sla_breach"] for r in [])) # 见下条逐次断言 + for r in results: + self.assertFalse(r["sla_breach"], + "latency_ms=%r 触发 sla_breach" % r["latency_ms"]) def test_each_write_reports_latency_and_sla(self): res = self.apply("ev-sla", states=[su()]) @@ -688,8 +691,6 @@ class TestScopeAndSqlContract(unittest.TestCase): def test_for_update_clause_degrades_by_dialect(self): self.assertEqual(" FOR UPDATE", sqlmod.for_update_clause(MYSQL)) self.assertEqual("", sqlmod.for_update_clause(SQLITE)) - self.assertIn("pbl_entity_state", - " ".join(s for s, _p in self_dummy_log()) if False else "pbl_entity_state") def test_placeholder_style_per_dialect(self): self.assertEqual("?", sqlmod.placeholder(SQLITE)) @@ -729,9 +730,6 @@ class TestScopeAndSqlContract(unittest.TestCase): self.assertEqual(1, eng.count(EVENT_TABLE)) # 只有成功那次留下事件 -def self_dummy_log(): - return [] - # ========================================================================= # 8. 确属 M11b-2a 契约变更而失效的旧用例(显式 xfail + 逐条理由,不 skip 不删)