Пример #1
0
def test_install_sqlite():
    """Installs modified scripts using sqlite engine"""
    dbfile = os.path.normpath(
        os.path.join(os.getcwd(), 'testdb_retriever.sqlite'))

    errors = []
    for script in global_modified_scripts:
        if script not in spatial_datasets_list:
            try:
                rt.install_sqlite(script,
                                  file=dbfile,
                                  table_name='{db}_{table}',
                                  debug=True)
            except KeyboardInterrupt:
                pass
            except Exception as e:
                errors.append(("sqlite", script, e))
    assert errors == []
Пример #2
0
def test_commit_installation(zip_file_name, expected_md5):
    """Installs the committed dataset in zip to sqlite and then converts
    it to csv to calculate md5 to compare it with the expected_md5"""
    db_name = 'test_sqlite.db'
    zip_file_path = os.path.join(file_location, "raw_data/dataset-provenance/", zip_file_name)
    engine = install_sqlite(zip_file_path, file=db_name, force=True)
    workdir = mkdtemp(dir=file_location)
    os.chdir(workdir)
    engine.to_csv()
    os.chdir(file_location)
    if os.path.isfile(db_name):
        os.remove(db_name)
    calculated_md5 = getmd5(workdir, data_type='dir', encoding=ENCODING)
    rmtree(workdir)
    assert calculated_md5 == expected_md5
from retriever import install_sqlite
install_sqlite('nyc-tree-count')
# -*- coding: utf-8 -*-

# Copyright (C) 2019  David Arroyo Menéndez

# Author: David Arroyo Menéndez <*****@*****.**>
# Maintainer: David Arroyo Menéndez <*****@*****.**>

# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.

# This file is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with GNU Emacs; see the file COPYING.  If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301 USA,

import retriever as rt
print(rt.dataset_names())
for dataset in rt.datasets():
    print(dataset.name)

print(rt.check_for_updates())

print(rt.install_sqlite('iris'))
from retriever import install_sqlite
install_sqlite('phytoplankton-size')