conftest.py (pytest fixtures)
What it is
- A
pytestconfiguration module that provides a fixture to initialize and retrieve the ChatGPTABIModulefor tests. - Ensures the
Engineloads the module before the singletonABIModuleinstance is accessed.
Public API
module() -> ABIModule(pytest fixture)- Creates an
Engine, loads the module named"src.core.chatgpt", then returnsABIModule.get_instance().
- Creates an
Configuration/Dependencies
- pytest: used for fixture declaration.
- naas_abi_core.engine.Engine.Engine: used to load modules.
- naas_abi_marketplace.ai.chatgpt.ABIModule: singleton module returned by the fixture.
- Module name loaded:
src.core.chatgpt(must be loadable byEngine.load).
Usage
def test_module_available(module):
# `module` is an instance of ABIModule provided by the fixture
assert module is not None
Caveats
- The fixture depends on
Engine.load(module_names=["src.core.chatgpt"])succeeding; missing/incorrect module registration will cause setup failures. ABIModule.get_instance()implies singleton behavior; tests may share module state across runs unless the implementation isolates it.