예제 #1
0
    def collapse_at_dead_end_test(self):
        wf = Workflow('', '')
        wf.add_commit(self._commit1)
        wf.add_commit(self._commit2)
        wf.add_commit(self._commit3)  # Dead end which cannot be collapsed

        self.assertEqual(len(wf._commits), 3)
        wf.collapse_repro_commits()
        self.assertEqual(len(wf._commits), 2)

        self.assertEqual(wf._commits[self._commit1.hash].text,
                         self._commit1._comment + '\n' + self._commit1.hash)
        self.assertEqual(wf._commits[self._commit3.hash].text,
                         Commit.COLLAPSED_TEXT)
        self.assertTrue('2' not in wf._commits)
        pass
예제 #2
0
    def collapse_test(self):
        wf = Workflow('', '')
        wf.add_commit(self._commit1)
        wf.add_commit(self._commit2)
        wf.add_commit(self._commit3)
        wf.add_commit(self._commit4)

        wf.collapse_repro_commits()

        self.assertEqual(len(wf._commits), 3)
        self.assertEqual(wf._commits[self._commit1.hash].text,
                         self._commit1._comment + '\n' + self._commit1.hash)
        self.assertEqual(wf._commits[self._commit3.hash].text,
                         Commit.COLLAPSED_TEXT)
        self.assertTrue('2' not in wf._commits)

        self.assertFalse('2' in wf._edges)
        self.assertFalse('2' in wf._back_edges)
        pass
예제 #3
0
    def collapse_metric_commit_test(self):
        value = 0.812345
        branches = ['master', 'try_smth']
        metric_commit3 = Commit('2',
                                '1',
                                'name1',
                                'today',
                                'DVC repro-run ...',
                                True,
                                value,
                                branch_tips=branches)

        wf = Workflow('', '')
        wf.add_commit(self._commit1)
        wf.add_commit(metric_commit3)
        wf.add_commit(self._commit3)

        self.assertEqual(len(wf._commits), 3)
        wf.collapse_repro_commits()
        self.assertEqual(len(wf._commits), 2)

        self.assertEqual(wf._commits['3']._target_metric, value)
        self.assertEqual(wf._commits['3'].branch_tips, branches)
        pass