Exemplo n.º 1
0
 def test_get_representation_stored(self, cache_env):
     # we can get paths of representations
     bucket = Bucket(str(cache_env.join("cache")))
     res1 = bucket.store_representation(
         str(cache_env / "src1.txt"),
         str(cache_env / "result1.txt"), repr_key=b'mykey')
     res2 = bucket.get_representation(res1)
     assert res1 == "1_1"
     assert res2 == cache_env / "cache" / "repr" / "1" / "1" / "result1.txt"
Exemplo n.º 2
0
 def test_get_representation_stored(self, cache_env):
     # we can get paths of representations
     bucket = Bucket(str(cache_env.join("cache")))
     res1 = bucket.store_representation(str(cache_env / "src1.txt"),
                                        str(cache_env / "result1.txt"),
                                        repr_key=b'mykey')
     res2 = bucket.get_representation(res1)
     assert res1 == "1_1"
     assert res2 == cache_env / "cache" / "repr" / "1" / "1" / "result1.txt"
Exemplo n.º 3
0
 def test_get_representation_stored(self):
     # we cannot get unstored representations
     bucket = Bucket(self.workdir)
     res1 = bucket.store_representation(
         self.src_path1, self.result_path1, repr_key=b'mykey')
     exp_repr_path = os.path.join(
         self.workdir, b'repr', b'1', b'1', b'resultfile1')
     res2 = bucket.get_representation(res1)
     self.assertEqual(res1, b'1_1')
     self.assertEqual(res2, exp_repr_path)
     return
Exemplo n.º 4
0
 def test_get_representation_unstored(self):
     # we cannot get unstored representations
     bucket = Bucket(self.workdir)
     self.assertEqual(bucket.get_representation(b'1_1'), None)
     return
Exemplo n.º 5
0
 def test_get_representation_unstored(self, tmpdir):
     # we cannot get unstored representations
     bucket = Bucket(str(tmpdir.join("cache")))
     assert bucket.get_representation("1_1") is None
Exemplo n.º 6
0
 def test_get_representation_unstored(self, tmpdir):
     # we cannot get unstored representations
     bucket = Bucket(str(tmpdir.join("cache")))
     assert bucket.get_representation("1_1") is None