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 07ce8bb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 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
8 changes: 7 additions & 1 deletion tests/test_local_files.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from __future__ import annotations

import os

import pytest
import requests

import skhep_testdata as skhtd

Expand All @@ -25,6 +25,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 07ce8bb

Please sign in to comment.