def python_path_spec() -> Do: dir = fixture_path('rplugin', 'path_spec') extra_path_pkg = fixture_path('rplugin', 'extra_path_pkg') yield NS.lift(variable_set_prefixed('autostart', True)) yield request('cram', f'dir:{dir}', name='path_spec', pythonpath=[extra_path_pkg]) result = yield NS.lift(call_once_defined('PathSpecTest', timeout=10)) return k(result) == 13
def extension_spec() -> Do: dir = fixture_path('rplugin', name) extension_path = fixture_path('rplugin', ext_name) yield NS.lift(variable_set_prefixed('autostart', True)) yield NS.lift(variable_set(f'{name}_components', List(f'{ext_name}.ext'))) yield request('cram', f'dir:{dir}', name='extension_spec', extensions=[extension_path]) result1 = yield NS.lift(call_once_defined('XTest', timeout=1)) result2 = yield NS.lift(call_once_defined('XExtTest', timeout=1)) return (k(result1) == 13) & (k(result2) == 23)
def setup(self): super().setup() self.base = temp_dir('projects', 'base') self.config = fixture_path('conf') self.type1 = 'type1' self.type1_base = temp_dir('projects', self.type1) self.type_bases = Map({self.type1_base: List(self.type1)})
def start_tmux(socket: str, win_width: int, win_height: int, term: bool = False) -> subprocess.Popen: conf = fixture_path('conf', 'tmux.conf') t = terminal_args(win_width, win_height) if term else [] args = t + ['tmux', '-L', socket, '-f', str(conf)] master, slave = pty.openpty() return subprocess.Popen(args, stdout=slave, stdin=slave, stderr=slave)
def setup(self): super().setup() self.pypro1_type = 'python' self.pypro1_name = 'pypro1' self.pypro2_name = 'pypro2' self.config = Path(fixture_path('conf')) self.project_base = Path(temp_dir('projects')) self.project_base2 = Path(temp_dir('projects2')) self.pypro1_root = self.mk_project_root(self.pypro1_type, self.pypro1_name) self.mk_project_root(self.pypro1_type, self.pypro2_name, self.project_base2) self.mk_project_root('other', 'other2', self.project_base2) self.type1_base = Path(temp_dir('type1_projects')) self.type1pro_name = 'type1pro' self.type1pro_root = temp_dir(self.type1_base / self.type1pro_name) self.type_bases = Map({self.type1_base: List('type1')}) self.resolver = Resolver(List(self.project_base, self.project_base2), self.type_bases) self.loader = ProjectLoader(self.config, self.resolver)
def rplugin_dir(name: str) -> str: return str(fixture_path('rplugin', name))
def _config_path(self): return fixture_path('additional_langs', 'conf.json')
def setup_venv_dir(venv_dir: Maybe[Path] = Nothing) -> Do: rtp = fixture_path('rplugin', 'config', 'rtp') yield option_cat('runtimepath', List(rtp)) dir = venv_dir | temp_dir('rplugin', 'venv') yield variable_set_prefixed('venv_dir', str(dir)) return dir
def setup_one(name: str, venv_dir: Maybe[Path]=Nothing) -> Do: plugin = simple_rplugin(name, name) path = fixture_path('rplugin', name) yield json_cmd('Cram', str(path), name=name) return plugin
from amino import List from amino.test import fixture_path from chromatin.model.rplugin import DistRplugin name1 = 'flagellum' name2 = 'cilia' path1 = fixture_path('rplugin', name1) path2 = fixture_path('rplugin', name2) plugin1 = DistRplugin.cons(name1, name1) plugin2 = DistRplugin.cons(name2, name2) plugins = List( dict(name=name1, spec=str(path1)), dict(name=name2, spec=str(path2)), ) __all__ = ( 'name1', 'name2', 'path1', 'path2', 'plugin1', 'plugin2', 'plugins', )
def hs_dir_spec() -> Do: flag_dir = fixture_path('rplugin', 'flagellum.hs') yield NS.lift(variable_set_prefixed('autostart', True)) yield request('cram', f'hs_dir:{flag_dir}', name='flagellum') yield NS.lift(wait_for_function('FlagTest', timeout=1)) return k(1) == 1
def dir_venv_spec() -> Do: flag_dir = fixture_path('rplugin', 'flagellum') yield NS.lift(variable_set_prefixed('autostart', True)) yield request('cram', f'dir:{flag_dir}', name='flagellum') yield NS.lift(wait_for_command('FlagTest', timeout=1)) yield NS.lift(await_k(log_entry, 'flagellum initialized'))
def dir_rplugin(self) -> Expectation: dir = fixture_path('rplugin', name, name) spec = f'dir:{dir}' plugin = DirRplugin.cons(name, str(dir)) return kf(simple_rplugin, name, spec) == plugin