def misc_11(): if not gdaltest.support_symlink(): return 'skip' try: os.unlink('tmp/symlink.tif') except: pass os.symlink('GTIFF_DIR:1:data/byte.tif', 'tmp/symlink.tif') ds = gdal.Open('tmp/symlink.tif') if ds is None: os.remove('tmp/symlink.tif') return 'fail' desc = ds.GetDescription() ds = None os.remove('tmp/symlink.tif') if desc != 'GTIFF_DIR:1:data/byte.tif': gdaltest.post_reason('did not get expected description') print(desc) return 'fail' return 'success'
def vrt_read_13(): if not gdaltest.support_symlink(): return 'skip' try: os.remove('tmp/byte.vrt') print('Removed tmp/byte.vrt. Was not supposed to exist...') except: pass try: os.remove('tmp/other_byte.vrt') print('Removed tmp/other_byte.vrt. Was not supposed to exist...') except: pass os.symlink('../data/byte.vrt', 'tmp/byte.vrt') os.symlink('../tmp/byte.vrt', 'tmp/other_byte.vrt') ds = gdal.Open('tmp/other_byte.vrt') os.remove('tmp/other_byte.vrt') os.remove('tmp/byte.vrt') if ds is None: return 'fail' return 'success'
def test_vrt_read_13(): if not gdaltest.support_symlink(): pytest.skip() try: os.remove('tmp/byte.vrt') print('Removed tmp/byte.vrt. Was not supposed to exist...') except OSError: pass try: os.remove('tmp/other_byte.vrt') print('Removed tmp/other_byte.vrt. Was not supposed to exist...') except OSError: pass os.symlink('../data/byte.vrt', 'tmp/byte.vrt') os.symlink('../tmp/byte.vrt', 'tmp/other_byte.vrt') ds = gdal.Open('tmp/other_byte.vrt') os.remove('tmp/other_byte.vrt') os.remove('tmp/byte.vrt') assert ds is not None
def vrt_read_13(): if not gdaltest.support_symlink(): return "skip" try: os.remove("tmp/byte.vrt") print("Removed tmp/byte.vrt. Was not supposed to exist...") except: pass try: os.remove("tmp/other_byte.vrt") print("Removed tmp/other_byte.vrt. Was not supposed to exist...") except: pass os.symlink("../data/byte.vrt", "tmp/byte.vrt") os.symlink("../tmp/byte.vrt", "tmp/other_byte.vrt") ds = gdal.Open("tmp/other_byte.vrt") os.remove("tmp/other_byte.vrt") os.remove("tmp/byte.vrt") if ds is None: return "fail" return "success"
def test_vrt_read_11(): if not gdaltest.support_symlink(): pytest.skip() try: os.remove('tmp/byte.vrt') print('Removed tmp/byte.vrt. Was not supposed to exist...') except OSError: pass os.symlink(os.path.join(os.getcwd(), 'data/byte.vrt'), 'tmp/byte.vrt') ds = gdal.Open('tmp/byte.vrt') os.remove('tmp/byte.vrt') assert ds is not None
def test_misc_11(): if not gdaltest.support_symlink(): pytest.skip() gdal.Unlink('tmp/symlink.tif') os.symlink('GTIFF_DIR:1:data/byte.tif', 'tmp/symlink.tif') ds = gdal.Open('tmp/symlink.tif') if ds is None: os.remove('tmp/symlink.tif') pytest.fail() desc = ds.GetDescription() ds = None os.remove('tmp/symlink.tif') assert desc == 'GTIFF_DIR:1:data/byte.tif', 'did not get expected description'
def vrt_read_11(): if not gdaltest.support_symlink(): return 'skip' try: os.remove('tmp/byte.vrt') print('Removed tmp/byte.vrt. Was not supposed to exist...') except: pass os.symlink(os.path.join(os.getcwd(), 'data/byte.vrt'), 'tmp/byte.vrt') ds = gdal.Open('tmp/byte.vrt') os.remove('tmp/byte.vrt') if ds is None: return 'fail' return 'success'
def vrt_read_11(): if not gdaltest.support_symlink(): return "skip" try: os.remove("tmp/byte.vrt") print("Removed tmp/byte.vrt. Was not supposed to exist...") except: pass os.symlink(os.path.join(os.getcwd(), "data/byte.vrt"), "tmp/byte.vrt") ds = gdal.Open("tmp/byte.vrt") os.remove("tmp/byte.vrt") if ds is None: return "fail" return "success"