1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2025-12-20 00:23:49 +03:00

sanitytest: move class method mapping fixup into a helper method

This is a step towards turning the sanitytest.py file into a normal
python unittest.

Best viewed with the '-b' flag to diff.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé
2022-03-22 17:52:55 +00:00
parent b29d0aaa26
commit 4ae177d49c

View File

@@ -197,7 +197,8 @@ for cname in wantfunctions:
basicklassmap[name] = ("libvirt", name[3:], cname)
# Phase 4: Deal with oh so many special cases in C -> python mapping
# Deal with oh so many special cases in C -> python mapping
def fixup_class_method_mapping(basicklassmap):
finalklassmap = {} # type: Dict[str, Tuple[str, str, str]]
for name, (klass, func, cname) in sorted(basicklassmap.items()):
@@ -317,6 +318,8 @@ for name, (klass, func, cname) in sorted(basicklassmap.items()):
finalklassmap[name] = (klass, func, cname)
return finalklassmap
# Validate that every C API is mapped to a python API
def validate_c_to_python_api_mappings(finalklassmap, gotfunctions):
@@ -373,6 +376,7 @@ def validate_c_api_bindings_present(finalklassmap):
try:
finalklassmap = fixup_class_method_mapping(basicklassmap)
usedfunctions = validate_c_to_python_api_mappings(finalklassmap, gotfunctions)
validate_python_to_c_api_mappings(gotfunctions, usedfunctions)
validate_c_api_bindings_present(finalklassmap)