def cycle(self): self.vim_mock.should_receive('switch_root').and_return(None) name = 'proj' name2 = 'proj2' pros = List(Project.of(name, null), Project.of(name2, null)) with self._prot(pros=pros) as prot: prot.data.current.should.equal(Just(pros[0])) prot.send_sync(Next())\ .current.should.equal(Just(pros[1])) prot.send_sync(Prev())\ .current.should.equal(Just(pros[0]))
def show(self): n = 'some name' d = Path('/dir/to/project') p2 = Projects() + Project.of(n, d) p2.show().should.equal(List('{}: {}'.format(n, d))) p2.show(List(n)).should.equal(List('{}: {}'.format(n, d))) str(p2).should.equal("Projects(Project('{}'))".format(n))
def fail(self): with test_loop() as loop: ctags = Ctags(None) p = Project.of('invalid', Path(temp_path('invalid')), tpe=Just('c'), langs=List('c')) result = loop.run_until_complete(ctags.gen(p)) result.success.should_not.be.ok
def remove(self): n = 'some name' d = '/dir/to/project' t = 'sometype' p2 = Projects() + Project.of(n, Path(d), Just(t)) pro = p2.project('{}/{}'.format(t, n)) pro.map(_.root).should.equal(Just(Path(d))) (p2 - pro._get).projects.should.be.empty
def run(self): with test_loop() as loop: ctags = Ctags(None) p = Project.of(self.pypro1_name, self.pypro1_root, tpe=Just(self.pypro1_type), langs=List(self.pypro1_type)) p.remove_tag_file() result = loop.run_until_complete(ctags.gen(p)) result.success.should.be.ok p.tag_file.exists().should.be.ok ctags.current.k.should.be.empty
def current_project(self): p = self.pypro1_root flexmock(ProjectAnalyzer)\ .should_receive('main_dir')\ .and_return(Just(p)) ctx = self._prot(b=List(self.project_base), t=self.type_bases) target = Project.of(self.pypro1_name, p, Just(self.pypro1_type)) with ctx as prot: prot.send_sync(StageI()) prot.send_sync(Nop())\ .projects.projects.head\ .should.equal(Just(target))
def add_by_params(self): tpe = 'ptype' name = 'pname' ident = '{}/{}'.format(tpe, name) root = temp_dir('plugin/from_params') params = Map( root=str(root), history=False, ) self.proteome.proteome_start() self.proteome.pro_add([ident] + json.dumps(params).split(' ')) self._await() self._projects.last.should.contain(Project.of(name, root, Just(tpe)))
def _pre_start(self): super()._pre_start() self.vim.vars.set_p('all_projects_history', True) self.test_file_1 = self.main_project / 'test_file_1' self.test_file_2 = self.main_project / 'test_file_2' self.test_content = List( 'content_1', 'content_2', 'content_3', ) self.test_file_1.write_text(self.test_content[0]) self.pro = Project.of(self.name1, self.main_project, Just(self.tpe1)) self.history = History(self.history_base) self.repo = self.history.repo(self.pro).x
def from_params(self): tpe = 'ptype' name = 'pname' ident = '{}/{}'.format(tpe, name) root = temp_dir('loader/from_params') types = List('a', 'b') langs = List('c', 'd') params = Map( types=types, langs=langs, history=False, ) pro = self.loader.from_params(ident, root, params) pro.should.contain(Project.of(name, root, Just(tpe))) pro.x.types.should.equal(types) pro.x.langs.should.equal(langs) pro.x.history.should_not.be.ok
def mk_project(self, name, tpe): root = temp_dir(str(self.temp_projects / tpe / name)) return Project.of(name, Path(root), tpe=Just(tpe))
def create(self): return self.data + Project.of(self.msg.name, Path(self.msg.root))
def resolve_ident_main_type(self): name = self.pypro1_name main = Just(self.pypro1_type) pro = self.loader.resolve_ident(name, main=main) pro.should.contain(Project.of(name, self.pypro1_root, main))
def from_params_no_type(self): name = 'pname' root = temp_dir('loader/from_params') pro = self.loader.from_params(name, root, Map()) pro.should.contain(Project.of(name, root, Empty()))