def stub_askar() -> Stub: # detect aries-askar library try: from aries_askar.bindings import get_library get_library() return Stub(None) except ImportError: print( "Skipping Askar-specific tests: aries_askar module not installed.") except OSError: print("Skipping Askar-specific tests: aries-askar shared library" "could not be loaded.") modules = {} package_name = "aries_askar" modules[package_name] = mock.MagicMock() for mod in [ "bindings", "error", "store", "types", ]: submod = f"{package_name}.{mod}" modules[submod] = mock.MagicMock() return Stub(mock.patch.dict(sys.modules, modules))
def stub_indy_vdr() -> Stub: # detect indy-vdr library try: from indy_vdr.bindings import get_library get_library() return Stub(None) except ImportError: print( "Skipping Indy-VDR-specific tests: indy_vdr module not installed.") except OSError: print("Skipping Indy-VDR-specific tests: indy-vdr shared library" "could not be loaded.") modules = {} package_name = "indy_vdr" modules[package_name] = mock.MagicMock() return Stub(mock.patch.dict(sys.modules, modules))
def stub_ursa_bbs_signatures() -> Stub: # detect ursa_bbs_signatures library try: from ursa_bbs_signatures._ffi.ffi_util import get_library get_library() return Stub(None) except ImportError: print("Skipping Ursa-BBS-Signatures-specific tests:" " ursa_bbs_signatures module not installed.") except (OSError, Exception): print( "Skipping Ursa-BBS-Signatures-specific tests: bbs shared library " "could not be loaded.") modules = {} package_name = "ursa_bbs_signatures" modules[package_name] = mock.MagicMock() return Stub(mock.patch.dict(sys.modules, modules))