コード例 #1
0
ファイル: history_spec.py プロジェクト: tek/proteome
 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
コード例 #2
0
ファイル: history_spec.py プロジェクト: tek/proteome
class _HistorySpec(ProteomePluginIntegrationSpec):

    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

    @property
    def _plugins(self):
        return List(
            'proteome.plugins.history',
        )

    @property
    def _object_count(self):
        return len(self.object_files(self.pro))

    def _wait_for_oc(self, count):
        self._wait_for(lambda: self._object_count > count)

    def _await_commit(self, num):
        self._await_content(self.test_content[num])

    def _await_content(self, text):
        def checker():
            self.test_file_1.read_text()\
                .should.equal(text)
        later(checker)

    def _write_file(self, num):
        self.test_file_1.write_text(self.test_content[num])

    def _write_file2(self, num):
        self.test_file_2.write_text(self.test_content[num])

    def _save(self):
        oc_pre = self._object_count
        self.vim.cmd('ProSave')
        self._wait_for_oc(oc_pre)
        self._wait(0.1)