34 lines
1.5 KiB
Python
34 lines
1.5 KiB
Python
"""Wrapper to ensure import stability for tests.
|
|
|
|
This module mirrors the public API of the package located in
|
|
``gameeconomy_forge_verifiable_dsl_driven_`` directory. Some test runners
|
|
may not resolve the package path as a Python package during collection,
|
|
so we explicitly load the package from its directory and re-export the API.
|
|
"""
|
|
import importlib.util
|
|
import os
|
|
import sys
|
|
|
|
_THIS_FILE_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
_PKG_DIR = os.path.join(_THIS_FILE_DIR, "gameeconomy_forge_verifiable_dsl_driven_")
|
|
_INIT_PY = os.path.join(_PKG_DIR, "__init__.py")
|
|
|
|
def _load_internal_package() -> object:
|
|
if not os.path.isdir(_PKG_DIR) or not os.path.exists(_INIT_PY):
|
|
raise FileNotFoundError("Internal package directory not found: %s" % _PKG_DIR)
|
|
spec = importlib.util.spec_from_file_location("_internal_gfvdd_pkg", _INIT_PY) # type: ignore
|
|
mod = importlib.util.module_from_spec(spec) # type: ignore
|
|
assert spec is not None and spec.loader is not None
|
|
spec.loader.exec_module(mod) # type: ignore
|
|
return mod
|
|
|
|
_internal = _load_internal_package()
|
|
|
|
# Re-export the needed API so tests can import from this top-level name.
|
|
__all__ = ["parse_dsl", "compile_flow", "attest_flow", "delta_sync", "aggregate_signals"]
|
|
parse_dsl = getattr(_internal, "parse_dsl")
|
|
compile_flow = getattr(_internal, "compile_flow")
|
|
attest_flow = getattr(_internal, "attest_flow")
|
|
delta_sync = getattr(_internal, "delta_sync")
|
|
aggregate_signals = getattr(_internal, "aggregate_signals")
|