Skip to content

Commit

Permalink
test: skip uncoverable lines
Browse files Browse the repository at this point in the history
  • Loading branch information
percevalw committed Aug 8, 2023
1 parent ad10476 commit 57e8600
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
6 changes: 3 additions & 3 deletions edsnlp/pipelines/ner/umls/patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ def get_patterns(config: Dict[str, Any]) -> Dict[str, List[str]]:

path, module, filename = get_path(config)

if path.exists():
if path.exists(): # pragma: no cover
print(f"Loading {filename} from {module.base}")
return module.load_pickle(name=filename)
else:
else: # pragma: no cover
patterns = download_and_agg_umls(config)
module.dump_pickle(name=filename, obj=patterns)
print(f"Saved patterns into {module.base / filename}")
Expand Down Expand Up @@ -108,7 +108,7 @@ def download_and_agg_umls(config) -> Dict[str, List[str]]:
"""

api_key = os.getenv("UMLS_API_KEY")
if not api_key:
if not api_key: # pragma: no cover
warnings.warn(
"You need to define UMLS_API_KEY to download the UMLS. "
"Get a key by creating an account at "
Expand Down
16 changes: 16 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,22 @@ omit-covered-files = false
# generate-badge = "."
# badge-format = "svg"


[tool.coverage]
exclude_lines = [
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
"if typing.TYPE_CHECKING:",
"@overload",
"pragma: no cover",
"raise AssertionError",
"raise NotImplementedError",
"def __repr__",
"Span.set_extension.*",
"Doc.set_extension.*",
"Token.set_extension.*",
]

[tool.cibuildwheel]
skip = [
"*p36-*", # Skip Python 3.6
Expand Down

0 comments on commit 57e8600

Please sign in to comment.