Esempio n. 1
0
 def setup(self):
     self.cache_dir = tempfile.mkdtemp()
     self.file_cache = FileCache(cache_dir=self.cache_dir, file_ext='png')
     self.grid = TileGrid(SRS(4326), bbox=[-180, -90, 180, 90])
     self.client = MockTileClient()
     self.source = TiledSource(self.grid, self.client)
     self.tile_mgr = TileManager(self.grid, self.file_cache, [self.source], 'png')
Esempio n. 2
0
 def setup(self):
     self.cache_dir = tempfile.mkdtemp()
     self.file_cache = FileCache(cache_dir=self.cache_dir, file_ext='png')
     self.grid = TileGrid(SRS(4326), bbox=[-180, -90, 180, 90])
     self.client = MockTileClient()
     self.source = TiledSource(self.grid, self.client)
     self.image_opts = ImageOptions(format='image/png')
     self.locker = TileLocker(tmp_lock_dir, 10, "id")
     self.tile_mgr = TileManager(self.grid, self.file_cache, [self.source], 'png',
         image_opts=self.image_opts,
         locker=self.locker)
Esempio n. 3
0
 def setup(self):
     TileCacheTestBase.setup(self)
     self.cache = FileCache(self.cache_dir, 'png', directory_layout='quadkey')
Esempio n. 4
0
 def setup(self):
     TileCacheTestBase.setup(self)
     self.cache = FileCache(self.cache_dir, 'png')
Esempio n. 5
0
def file_cache(tmpdir):
    return FileCache(cache_dir=tmpdir.join('cache').strpath, file_ext='png')
Esempio n. 6
0
 def check_level_location(self, layout, level, path):
     cache = FileCache('/tmp/foo', 'png', directory_layout=layout)
     eq_(cache.level_location(level), path)
Esempio n. 7
0
 def check_tile_location(self, layout, tile_coord, path):
     cache = FileCache('/tmp/foo', 'png', directory_layout=layout)
     eq_(cache.tile_location(Tile(tile_coord)), path)
Esempio n. 8
0
 def test_level_location_quadkey(self):
     cache = FileCache('/tmp/foo', 'png', directory_layout='quadkey')
     with pytest.raises(NotImplementedError):
         cache.level_location(0)
Esempio n. 9
0
 def test_level_location(self, layout, level, path):
     cache = FileCache('/tmp/foo', 'png', directory_layout=layout)
     assert os.path.abspath(
         cache.level_location(level)) == os.path.abspath(path)
Esempio n. 10
0
 def test_tile_location(self, layout, tile_coord, path):
     cache = FileCache('/tmp/foo', 'png', directory_layout=layout)
     assert os.path.abspath(cache.tile_location(
         Tile(tile_coord))) == os.path.abspath(path)