Files
openfe/openfecli/tests/test_fetchables.py
Alyssa Travitz b5eb3e227e move test data to zenodo (#1148)
* test out pooch

* adding zenodo dois

* remove unused import

* delete rbfe_result data from local storage

* move into a fixture factory

* updating missing legs tests

* Revert "delete rbfe_result data from local storage"

This reverts commit 1211200947e38ad17df50ebc3e67eb801e0bf0a4.

* updating failed edges tests

* updating test names to rbfe

* adding zenodo fetchable

* splitting out docs func

* move data out of fixture

* Revert "adding zenodo fetchable"

This reverts commit 5c72321e0e60d09339aee726c06bcda1190a6beb.

* add check for data cache

* cleaning up straggling changes

* remove data that's now on zenodo

* adding correctly compressed results data
2025-02-21 10:19:15 -08:00

34 lines
1.0 KiB
Python

import pytest
from click.testing import CliRunner
from .conftest import HAS_INTERNET
import pathlib
from openfecli.fetching import FetchablePlugin
from openfecli.fetchables import (
RBFE_TUTORIAL, RBFE_TUTORIAL_RESULTS, RBFE_SHOWCASE
)
def fetchable_test(fetchable):
"""Unit test to ensure that a given FetchablePlugin works"""
assert isinstance(fetchable, FetchablePlugin)
expected_paths = [pathlib.Path(f) for f in fetchable.filenames]
runner = CliRunner()
if fetchable.fetcher.REQUIRES_INTERNET and not HAS_INTERNET: # -no-cov-
pytest.skip("Internet seems to be unavailable")
with runner.isolated_filesystem():
result = runner.invoke(fetchable.command, ['-d' 'output-dir'])
assert result.exit_code == 0
for path in expected_paths:
assert (pathlib.Path("output-dir") / path).exists()
def test_rbfe_tutorial():
fetchable_test(RBFE_TUTORIAL)
def test_rbfe_tutorial_results():
fetchable_test(RBFE_TUTORIAL_RESULTS)
def test_rbfe_showcase():
fetchable_test(RBFE_SHOWCASE)