Esempio n. 1
0
def test_info():
    gpkg = QGpkg('tests/data/small_world.gpkg', nolog)
    gpkg.info()
    output = sys.stdout.getvalue().strip()
    info = """gpkg_contents features:
ne_110m_admin_0_countries
gpkg_contents tiles:
small_world
GPKG extensions:
gpkg_rtree_index"""
    assert output == info
Esempio n. 2
0
def test_write():
    # Copy test data
    tmp_folder = copy_to_tmp('tests/data')
    gpkg_path = os.path.join(tmp_folder, 'small_world.gpkg')
    qgs_path = os.path.join(tmp_folder, 'small_world.qgs')
    gpkg = QGpkg(gpkg_path, nolog)
    gpkg.write(qgs_path)
    gpkg.info()
    output = sys.stdout.getvalue().strip()
    info = """gpkg_contents features:
ne_110m_admin_0_countries
gpkg_contents tiles:
small_world
GPKG extensions:
qgis
gpkg_rtree_index
QGIS projects:
small_world.qgs
QGIS recources:
qgis.png"""
    assert output == info
Esempio n. 3
0
def test_no_gpkg():
    gpkg = QGpkg("./tests/test_info.py", nolog)
    gpkg.info()
    output = sys.stdout.getvalue().strip()
    assert output == ""
Esempio n. 4
0
def test_wrong_file():
    gpkg = QGpkg('wrong_file_name.gpkg', nolog)
    gpkg.info()
    output = sys.stdout.getvalue().strip()
    assert output == ""
Esempio n. 5
0
def read(args):
    gpkg = QGpkg(args.gpkg, log)
    gpkg.read(args.gpkg)
    return 0
Esempio n. 6
0
def write(args):
    gpkg = QGpkg(args.gpkg, log)
    gpkg.write(args.qgs)
    return 0
Esempio n. 7
0
def info(args):
    gpkg = QGpkg(args.gpkg, log)
    gpkg.info()
    return 0