Esempio n. 1
0
def test_reset_retriever(tmpdir):
    """Test the dataset reset function."""

    pwd_name = os.getcwd()
    workdir = tmpdir.mkdtemp()
    workdir.chdir()
    offline_datasets = rt.dataset_names()['offline']
    offline_datasets = [
        dataset for dataset in offline_datasets
        if not dataset.startswith('test-')
    ]
    if not offline_datasets:
        return
    dataset = random.choice(offline_datasets)
    rt.reset_retriever(dataset)
    rt.reload_scripts()
    assert os.path.exists(
        os.path.join(HOME_DIR,
                     dataset.replace("-", "_") + ".json")) == False
    assert os.path.exists(
        os.path.join(HOME_DIR,
                     dataset.replace("-", "_") + ".py")) == False
    if dataset in RETRIEVER_DATASETS:
        rt.get_script_upstream(dataset, repo=RETRIEVER_REPOSITORY)
    else:
        rt.get_script_upstream(dataset)
    rt.reload_scripts()
    assert dataset in rt.dataset_names()['offline']
    os.chdir(pwd_name)
Esempio n. 2
0
def test_reset_retriever(tmpdir):
    """Test the dataset reset function."""

    pwd_name = os.getcwd()
    workdir = tmpdir.mkdtemp()
    workdir.chdir()
    dataset = random.choice(rt.dataset_names())
    rt.reset_retriever(dataset)
    rt.reload_scripts()
    assert dataset not in rt.dataset_names()
    rt.check_for_updates()
    rt.reload_scripts()
    assert dataset in rt.dataset_names()
    os.chdir(pwd_name)
Esempio n. 3
0
def test_dataset_names():
    """Check if dataset names lookup includes a known value"""
    assert 'mammal-masses' in rt.dataset_names()
Esempio n. 4
0
def test_dataset_names():
    """Check if dataset names lookup includes a known value"""
    assert 'mammal-masses' in rt.dataset_names()
Esempio n. 5
0
def test_restiever_test_scripts():
    """Test retriever test scripts"""
    assert set(TESTS_SCRIPTS).issubset(set(dataset_names()))
# -*- 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'))
Esempio n. 7
0
def test_dataset_names():
    """Check if dataset names lookup includes a known value"""
    datasets = rt.dataset_names()
    dataset_names = datasets['offline']
    dataset_names.extend(datasets['online'])
    assert 'mammal-masses' in dataset_names
def test_restiever_test_scripts():
    """Test Retriever test scripts"""
    datasets_list = dataset_names()
    assert set(TESTS_SCRIPTS).issubset(
        set(datasets_list['online'] + datasets_list['offline']))