def test_built(self): with tempfile.TemporaryDirectory() as d: # First, test without built file self.assertFalse(download.built(d, "0.2")) download.mark_done(d, "0.1") # Test correct version self.assertTrue(download.built(d, "0.1")) # Test wrong version self.assertFalse(download.built(d, "0.2"))
def test_mark_done(self): with tempfile.TemporaryDirectory() as d: path = os.path.join(d, ".built.json") self.assertFalse(os.path.exists(path)) download.mark_done(d, "0.1") self.assertTrue(os.path.exists(path)) with open(path) as f: import json data = json.load(f) self.assertEqual(list(data.keys()), ["created_at", "version"])