Skip to content

Commit

Permalink
Improve test coverage a little bit
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardo-rodrigues committed Apr 30, 2024
1 parent 5cfc276 commit 2b26f35
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/skhep_testdata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
__all__ = ("data_path", "download_all", "known_files", "__version__")


def __dir__() -> tuple[str, ...]:
def __dir__() -> tuple[str, ...]: # pragma: no cover
return __all__
2 changes: 1 addition & 1 deletion src/skhep_testdata/local_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from . import data, remote_files

if sys.version_info < (3, 9):
import importlib_resources as resources
import importlib_resources as resources # pragma: no cover
else:
from importlib import resources

Expand Down
2 changes: 1 addition & 1 deletion src/skhep_testdata/remote_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import yaml

if sys.version_info < (3, 9):
import importlib_resources as resources
import importlib_resources as resources # pragma: no cover
else:
from importlib import resources

Expand Down
7 changes: 7 additions & 0 deletions tests/test_local_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os

import pytest
import requests

import skhep_testdata as skhtd

Expand All @@ -25,6 +26,12 @@ def test_data_path_missing():
skhtd.data_path("doesnt-exist.root", raise_missing=True)


def test_data_path_cached():
skhtd.known_files.add("dummy-cached.root")
with pytest.raises(requests.exceptions.HTTPError):
skhtd.data_path("dummy-cached.root", raise_missing=False, cache_dir="tmp")


def test_delegate_to_remote(monkeypatch, tmpdir):
def dummy_remote_file(filename, data_dir=None, raise_missing=False):
if not data_dir:
Expand Down

0 comments on commit 2b26f35

Please sign in to comment.