You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
_get_app_matching_name (and get_app) will take a full scope but only use the app name when requesting app attributes to construct the app instance so get_app will return the first app that matches the name without reference to scope.
Modify get_app(name) and available_apps(name) and app_help(name) to support scoped names, and get the following test to pass
# add a new to_json app that should collide with the internal to_json app@define_appclassto_json:
defmain(self, data: c3types.SerialisableType) ->str:
"""Convert primitive python types to json string."""returnjson.dumps(data)
@classmethoddef_requires_imports(cls):
return ["from cogent3.app import typing as c3types"]
fromstevedore.extensionimportExtensionManager@pytest.mark.parametrize("install_temp_app", [to_json], indirect=True)deftest_app_namespace_collision(install_temp_app):
em=ExtensionManager(namespace="cogent3.app", invoke_on_load=False)
to_json_extensions= [extforextinem.extensionsifext.name=="to_json"]
assertlen(to_json_extensions) ==2withpytest.raises(NameError): # should raise an error if name is not scopedto_json=get_app("to_json")
assertavailable_apps("to_json").shape[0] ==2# get apps by scope internal_to_json=get_app("cogent3.app.io.to_json")
added_to_json=get_app("temp_app_to_json.to_json")
# test the new app and internal app are equivalentdata= {"a": 1, "b": 2}
assertinternal_to_json(data) ==added_to_json(data) ==json.dumps(data)
The text was updated successfully, but these errors were encountered:
fixture for dynamically loading and unloading test apps. Move tests into this file from test_composable.py that specifically test registration of apps and remove the xfail decoration from these tests.
Test help documentation using a test app and _make_apphelp_docstring(app)
_get_app_matching_name
(andget_app
) will take a full scope but only use the app name when requesting app attributes to construct the app instance so get_app will return the first app that matches the name without reference to scope.Modify
get_app(name)
andavailable_apps(name)
andapp_help(name)
to support scoped names, and get the following test to passThe text was updated successfully, but these errors were encountered: