Skip to content

Commit

Permalink
Extend coverage config
Browse files Browse the repository at this point in the history
  • Loading branch information
yalef committed Dec 4, 2023
1 parent b9896d3 commit e878b49
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ jobs:

- name: Upload results to coveralls
run: |
pip install coveralls
coveralls --service=github
poetry run pip install coveralls
poetry run coveralls --service=github
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
Expand Down
4 changes: 1 addition & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ repos:
- id: tests
name: run tests
entry:
inv python.run
" -m coverage run --source import_export_extensions
--omit import_export_extensions/migrations -m pytest -v"
inv python.run " -m coverage run -m pytest -v"
language: system
pass_filenames: false
types: [ python ]
Expand Down
8 changes: 4 additions & 4 deletions import_export_extensions/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,13 @@ def clean(
"""
if not value:
return []
return [] # pragma: no cover

# if value is one integer number
value = str(value)

# in some cases if click `enter` values `\n\r` inserted
if self.instance_separator == "\n":
if self.instance_separator == "\n": # pragma: no cover
value = value.replace("\r", "")

raw_instances = utils.clean_sequence_of_string_values(
Expand Down Expand Up @@ -287,7 +287,7 @@ def __init__(self, filename: str):
def render(self, value: Model, *args, **kwargs) -> typing.Optional[str]:
"""Convert DB value to URL to file."""
if not value:
return None
return None # pragma: no cover

if self._get_default_storage() == DEFAULT_SYSTEM_STORAGE:
return f"http://localhost:8000{value.url}"
Expand All @@ -297,7 +297,7 @@ def render(self, value: Model, *args, **kwargs) -> typing.Optional[str]:
def clean(self, value: str, *args, **kwargs) -> typing.Optional[str]:
"""Get the file and check for exists."""
if not value:
return None
return None # pragma: no cover

internal_url = utils.url_to_internal_value(urlparse(value).path)

Expand Down
24 changes: 24 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,27 @@ python_files = [
"test_*.py",
"*_tests.py",
]

[tool.coverage.run]
source = [
"import_export_extensions",
]
omit = [
"import_export_extensions/migrations",
"*/__init__.py",
]

[tool.coverage.report]
exclude_lines = [
"def __repr__",
"def __str__",
"pass",
"if self.debug:",
"if settings.DEBUG",
"raise AssertionError",
"raise NotImplementedError",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
"class .*\\bProtocol\\):",
"@(abc\\.)?abstractmethod",
]

0 comments on commit e878b49

Please sign in to comment.