from ribosome.nvim.io.state import NS from ribosome.test.prog import request from ribosome.test.unit import unit_test, update_data from ribosome.data.plugin_state import PS from test.base import rplugin_dir, single_venv_config, present_venv from amino import Map, List, do, Do from amino.test.spec import SpecBase from amino.lenses.lens import lens from chromatin.model.rplugin import ActiveRpluginMeta from chromatin.util import resources name = 'flagellum' spec = rplugin_dir(name) active_rplugin = ActiveRpluginMeta(name, 3, 1111) rplugin, venv, conf = single_venv_config( name, spec, chromatin_rplugins=[dict(name=name, spec=spec)]) @do(NS[PS, Expectation]) def one_spec() -> Do: yield NS.lift(present_venv(name)) yield update_data( rplugins=List(rplugin), venvs=List(name), active=List(active_rplugin), ready=List(name), ) yield request('update', 'flagellum')
def directory(self) -> Expectation: plugins_dir = rplugin_dir(name) plugin_dir = Path(plugins_dir) / name spec = f'dir:{plugin_dir}' rplugin, venv, conf = single_venv_config(name, spec) return unit_test(conf, directory_spec, spec)
def hs_directory(self) -> Expectation: plugin_dir = rplugin_dir(hs_name) spec = f'hs_dir:{plugin_dir}' rplugin, venv, conf = single_venv_config(name, spec) return unit_test(conf, hs_directory_spec, spec)
def add(self) -> Expectation: spec = rplugin_dir(name) rplugin, venv, conf = single_venv_config(name, spec) return unit_test(conf, add_spec, spec)