test: lock final release index closure
This commit is contained in:
@@ -146,6 +146,7 @@ TRAINING_M41_RELEASE_INDEX_GUARD_TEST_INVENTORY = (
|
||||
"test_training_m83_release_index_source_shape_fixture_guard_methods_constant_exactness_bridge_triplet_diagnostic_fixture_inventory_guard_cluster_constant_source_shape_edge_diagnostics_are_locked",
|
||||
"test_training_m84_release_index_source_shape_fixture_guard_methods_constant_exactness_bridge_triplet_diagnostic_fixture_inventory_guard_cluster_inventory_self_lock",
|
||||
"test_training_m85_release_index_public_docs_acceptance_inventory_alignment_self_lock",
|
||||
"test_training_m86_release_index_final_closure_delivery_index_self_lock",
|
||||
"test_training_m53_release_index_doc_category_coverage_is_exact",
|
||||
"test_training_case_product_doc_reflects_current_m40_maturity",
|
||||
)
|
||||
@@ -705,6 +706,9 @@ class DocumentationConsistencyTests(unittest.TestCase):
|
||||
"release_index_public_docs_acceptance_inventory_alignment": (
|
||||
"test_training_m85_release_index_public_docs_acceptance_inventory_alignment_self_lock"
|
||||
),
|
||||
"release_index_final_closure_delivery": (
|
||||
"test_training_m86_release_index_final_closure_delivery_index_self_lock"
|
||||
),
|
||||
"per_doc_helper_exact_category_coverage": (
|
||||
"test_training_m53_release_index_doc_category_coverage_is_exact"
|
||||
),
|
||||
@@ -885,6 +889,7 @@ class DocumentationConsistencyTests(unittest.TestCase):
|
||||
"test_training_m83_release_index_source_shape_fixture_guard_methods_constant_exactness_bridge_triplet_diagnostic_fixture_inventory_guard_cluster_constant_source_shape_edge_diagnostics_are_locked",
|
||||
"test_training_m84_release_index_source_shape_fixture_guard_methods_constant_exactness_bridge_triplet_diagnostic_fixture_inventory_guard_cluster_inventory_self_lock",
|
||||
"test_training_m85_release_index_public_docs_acceptance_inventory_alignment_self_lock",
|
||||
"test_training_m86_release_index_final_closure_delivery_index_self_lock",
|
||||
"test_training_m53_release_index_doc_category_coverage_is_exact",
|
||||
"test_training_case_product_doc_reflects_current_m40_maturity",
|
||||
)
|
||||
@@ -2858,6 +2863,131 @@ class DocumentationConsistencyTests(unittest.TestCase):
|
||||
self.assertIn(guard_name, role_methods)
|
||||
self.assertIn(guard_name, expected_inventory)
|
||||
|
||||
def test_training_m86_release_index_final_closure_delivery_index_self_lock(
|
||||
self,
|
||||
) -> None:
|
||||
guard_name = "test_training_m86_release_index_final_closure_delivery_index_self_lock"
|
||||
closure_methods = (
|
||||
"test_training_m79_release_index_source_shape_fixture_guard_methods_constant_exactness_bridge_triplet_diagnostic_fixture_inventory_guard_cluster_self_lock",
|
||||
"test_training_m80_release_index_source_shape_fixture_guard_methods_constant_exactness_bridge_triplet_diagnostic_fixture_inventory_guard_cluster_negative_fixture_self_lock",
|
||||
"test_training_m81_release_index_source_shape_fixture_guard_methods_constant_exactness_bridge_triplet_diagnostic_fixture_inventory_guard_cluster_constant_source_shape_self_lock",
|
||||
"test_training_m82_release_index_source_shape_fixture_guard_methods_constant_exactness_bridge_triplet_diagnostic_fixture_inventory_guard_cluster_constant_source_shape_rejects_dynamic_sources",
|
||||
"test_training_m83_release_index_source_shape_fixture_guard_methods_constant_exactness_bridge_triplet_diagnostic_fixture_inventory_guard_cluster_constant_source_shape_edge_diagnostics_are_locked",
|
||||
"test_training_m84_release_index_source_shape_fixture_guard_methods_constant_exactness_bridge_triplet_diagnostic_fixture_inventory_guard_cluster_inventory_self_lock",
|
||||
"test_training_m85_release_index_public_docs_acceptance_inventory_alignment_self_lock",
|
||||
)
|
||||
module_source = Path(__file__).read_text(encoding="utf-8")
|
||||
module_tree = ast.parse(module_source)
|
||||
test_case_name = f"{type(self).__module__}.{type(self).__qualname__}"
|
||||
|
||||
def local_assignment_value(method_name: str, local_name: str) -> ast.AST:
|
||||
methods = tuple(
|
||||
node
|
||||
for node in ast.walk(module_tree)
|
||||
if isinstance(node, ast.FunctionDef) and node.name == method_name
|
||||
)
|
||||
self.assertEqual(len(methods), 1)
|
||||
assignments = tuple(
|
||||
node.value
|
||||
for node in ast.walk(methods[0])
|
||||
if (
|
||||
isinstance(node, ast.Assign)
|
||||
and len(node.targets) == 1
|
||||
and isinstance(node.targets[0], ast.Name)
|
||||
and node.targets[0].id == local_name
|
||||
)
|
||||
)
|
||||
|
||||
self.assertEqual(len(assignments), 1)
|
||||
return assignments[0]
|
||||
|
||||
role_mapping = ast.literal_eval(
|
||||
local_assignment_value(
|
||||
"test_training_m41_release_index_guard_inventory_is_current",
|
||||
"required_guard_tests_by_role",
|
||||
)
|
||||
)
|
||||
role_methods = tuple(role_mapping.values())
|
||||
expected_inventory = ast.literal_eval(
|
||||
local_assignment_value(
|
||||
"test_training_m52_release_index_guard_inventory_order_and_uniqueness_self_lock",
|
||||
"expected_inventory",
|
||||
)
|
||||
)
|
||||
m84_governance_methods = ast.literal_eval(
|
||||
local_assignment_value(
|
||||
"test_training_m84_release_index_source_shape_fixture_guard_methods_constant_exactness_bridge_triplet_diagnostic_fixture_inventory_guard_cluster_inventory_self_lock",
|
||||
"expected_governance_methods",
|
||||
)
|
||||
)
|
||||
delivery_methods = (*closure_methods, guard_name)
|
||||
closure_start = TRAINING_M41_RELEASE_INDEX_GUARD_TEST_INVENTORY.index(
|
||||
closure_methods[0]
|
||||
)
|
||||
m79_m83_methods = closure_methods[:5]
|
||||
|
||||
self.assertEqual(
|
||||
TRAINING_M41_RELEASE_INDEX_GUARD_TEST_INVENTORY[
|
||||
closure_start : closure_start + len(closure_methods)
|
||||
],
|
||||
closure_methods,
|
||||
)
|
||||
self.assertEqual(
|
||||
TRAINING_M41_RELEASE_INDEX_GUARD_TEST_INVENTORY[
|
||||
closure_start : closure_start + len(delivery_methods)
|
||||
],
|
||||
delivery_methods,
|
||||
)
|
||||
self.assertEqual(
|
||||
TRAINING_M41_RELEASE_INDEX_DIAGNOSTIC_FIXTURE_INVENTORY_GUARD_CLUSTER_GOVERNANCE_METHODS,
|
||||
m79_m83_methods,
|
||||
)
|
||||
self.assertEqual(m84_governance_methods, m79_m83_methods)
|
||||
self.assertEqual(
|
||||
TRAINING_M41_RELEASE_INDEX_GUARD_TEST_INVENTORY.index(
|
||||
"test_training_m85_release_index_public_docs_acceptance_inventory_alignment_self_lock"
|
||||
),
|
||||
TRAINING_M41_RELEASE_INDEX_GUARD_TEST_INVENTORY.index(
|
||||
"test_training_m84_release_index_source_shape_fixture_guard_methods_constant_exactness_bridge_triplet_diagnostic_fixture_inventory_guard_cluster_inventory_self_lock"
|
||||
)
|
||||
+ 1,
|
||||
)
|
||||
|
||||
for method_name in closure_methods:
|
||||
with self.subTest(method_name=method_name):
|
||||
self.assertEqual(
|
||||
TRAINING_M41_RELEASE_INDEX_GUARD_TEST_INVENTORY.count(
|
||||
method_name
|
||||
),
|
||||
1,
|
||||
)
|
||||
self.assertEqual(role_methods.count(method_name), 1)
|
||||
self.assertEqual(expected_inventory.count(method_name), 1)
|
||||
|
||||
loader = unittest.TestLoader()
|
||||
suite = loader.loadTestsFromName(f"{test_case_name}.{method_name}")
|
||||
|
||||
self.assertEqual(loader.errors, [])
|
||||
self.assertEqual(suite.countTestCases(), 1)
|
||||
|
||||
self.assertEqual(
|
||||
TRAINING_M41_RELEASE_INDEX_GUARD_TEST_INVENTORY.count(guard_name),
|
||||
1,
|
||||
)
|
||||
self.assertEqual(role_methods.count(guard_name), 1)
|
||||
self.assertEqual(expected_inventory.count(guard_name), 1)
|
||||
self.assertEqual(CURRENT_TRAINING_DOC_MATURITY_MARKER, "M1-M40")
|
||||
self.assertEqual(CURRENT_TRAINING_DOC_MATURITY_SPAN, "through M40")
|
||||
self.assertEqual(
|
||||
CURRENT_TRAINING_DOC_MATURITY_PHRASE,
|
||||
"current product maturity through M40",
|
||||
)
|
||||
for path in TRAINING_M41_RELEASE_INDEX_DOCS:
|
||||
text = path.read_text(encoding="utf-8")
|
||||
with self.subTest(path=path.name):
|
||||
self.assertIn(CURRENT_TRAINING_DOC_MATURITY_MARKER, text)
|
||||
self.assertIn(CURRENT_TRAINING_DOC_MATURITY_SPAN, text)
|
||||
|
||||
def test_training_m47_release_index_per_doc_helper_inventory_self_lock_is_current(self) -> None:
|
||||
helper_name = "_release_index_missing_required_snippets_by_doc"
|
||||
docs_guard_name = "test_training_readmes_expose_m1_m40_release_index_without_raw_test_modules"
|
||||
|
||||
Reference in New Issue
Block a user