Пример #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)
Пример #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)