Пример #1
0
 def test_recommit(self):
     """
     Should raise an exception preventing a straight-recommit.
     """
     a = AbstractDROP('a', 'a')
     a.reproducibility_level = ReproducibilityFlags.RERUN
     a.setCompleted()
     with self.assertRaises(Exception):
         a.commit()
Пример #2
0
 def test_set_all_set_rerun(self):
     """
     Tests taking a drop that was set to ALL to be set to RERUN and have data structures
     reset correctly.
     """
     drop_a = AbstractDROP("a", "a")
     self.assertIsNone(drop_a.merkleroot)
     drop_a.reproducibility_level = ReproducibilityFlags.ALL
     drop_a.commit()
     self.assertTrue(isinstance(drop_a.merkleroot, dict))
     drop_a.reproducibility_level = ReproducibilityFlags.RERUN
     drop_a.commit()
     self.assertTrue(isinstance(drop_a.merkleroot, str))
Пример #3
0
    def test_set_reproducibility_level(self):
        """
        Tests functionality for changing a DROP's reproducibility flag
        If already committed. The drop should reset and re-commit all reproducibility data
        If not committed, the change can proceed simply.
        """
        drop_a = AbstractDROP("a", "a")
        drop_b = AbstractDROP("b", "b")
        drop_a.reproducibility_level = ReproducibilityFlags.NOTHING
        drop_b.reproducibility_level = ReproducibilityFlags.NOTHING

        drop_a.setCompleted()
        self.assertIsNone(drop_a.merkleroot)
        drop_a.reproducibility_level = ReproducibilityFlags.RERUN
        drop_a.commit()
        self.assertIsNotNone(drop_a.merkleroot)

        self.assertIsNone(drop_b.merkleroot)
        drop_b.reproducibility_level = ReproducibilityFlags.RERUN
        drop_b.setCompleted()
        self.assertIsNotNone(drop_b.merkleroot)

        with self.assertRaises(TypeError):
            drop_a.reproducibility_level = "REPEAT"