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:
@@ -197,10 +197,11 @@ for cname in wantfunctions:
|
||||
basicklassmap[name] = ("libvirt", name[3:], cname)
|
||||
|
||||
|
||||
# Phase 4: Deal with oh so many special cases in C -> python mapping
|
||||
finalklassmap = {} # type: Dict[str, Tuple[str, str, str]]
|
||||
# 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()):
|
||||
for name, (klass, func, cname) in sorted(basicklassmap.items()):
|
||||
# The object lifecycle APIs are irrelevant since they're
|
||||
# used inside the object constructors/destructors.
|
||||
if func in ["Ref", "Free", "New", "GetConnect", "GetDomain", "GetNetwork"]:
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user