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')
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)
def setup(self): TileCacheTestBase.setup(self) self.cache = FileCache(self.cache_dir, 'png', directory_layout='quadkey')
def setup(self): TileCacheTestBase.setup(self) self.cache = FileCache(self.cache_dir, 'png')
def file_cache(tmpdir): return FileCache(cache_dir=tmpdir.join('cache').strpath, file_ext='png')
def check_level_location(self, layout, level, path): cache = FileCache('/tmp/foo', 'png', directory_layout=layout) eq_(cache.level_location(level), path)
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)
def test_level_location_quadkey(self): cache = FileCache('/tmp/foo', 'png', directory_layout='quadkey') with pytest.raises(NotImplementedError): cache.level_location(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)
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)