Skip to content

Commit

Permalink
Add Codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Hadley committed Jun 9, 2023
1 parent 23f1f40 commit 7385067
Show file tree
Hide file tree
Showing 8 changed files with 117 additions and 16 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3.5.3
uses: actions/checkout@v3

- name: Install Poetry
run: pipx install poetry==${{ env.POETRY_VERSION }}

- name: Set up Python with Poetry cache
uses: actions/setup-python@v4.6.1
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: poetry
Expand Down Expand Up @@ -54,4 +54,7 @@ jobs:
run: poetry run mypy paramdb tests

- name: Test (Pytest)
run: poetry run pytest
run: poetry run pytest --cov=paramdb --cov-report=xml

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
8 changes: 4 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3.5.3
uses: actions/checkout@v3

- name: Install Poetry
run: pipx install poetry==${{ env.POETRY_VERSION }}
Expand All @@ -22,7 +22,7 @@ jobs:
run: poetry build

- name: Upload package artifact
uses: actions/upload-artifact@v3.1.2
uses: actions/upload-artifact@v3
with:
name: paramdb-release
path: dist
Expand All @@ -36,10 +36,10 @@ jobs:
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v3.0.2
- uses: actions/download-artifact@v3
with:
name: paramdb-release
path: dist

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@v1.8.6
uses: pypa/gh-action-pypi-publish@release/v1
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jupyter_execute/
__pycache__/
.mypy_cache/
.pytest_cache/
.coverage
coverage.xml

# Database files
*.db
Expand Down
4 changes: 2 additions & 2 deletions paramdb/_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,13 @@ def commit(self, message: str, data: T) -> int:
@overload
def load(
self, commit_id: int | None = None, *, load_classes: Literal[True] = True
) -> T:
) -> T: # pragma: no cover
...

@overload
def load(
self, commit_id: int | None = None, *, load_classes: Literal[False]
) -> dict[str, Any]:
) -> dict[str, Any]: # pragma: no cover
...

def load(self, commit_id: int | None = None, *, load_classes: bool = True) -> Any:
Expand Down
8 changes: 4 additions & 4 deletions paramdb/_param_data/_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,22 +61,22 @@ def __init__(self, iterable: Iterable[T] | None = None) -> None:
self._add_child(item)

@overload
def __getitem__(self, index: SupportsIndex) -> T:
def __getitem__(self, index: SupportsIndex) -> T: # pragma: no cover
...

@overload
def __getitem__(self, index: slice) -> list[T]:
def __getitem__(self, index: slice) -> list[T]: # pragma: no cover
...

def __getitem__(self, index: Any) -> Any:
return self._contents[index]

@overload
def __setitem__(self, index: SupportsIndex, value: T) -> None:
def __setitem__(self, index: SupportsIndex, value: T) -> None: # pragma: no cover
...

@overload
def __setitem__(self, index: slice, value: Iterable[T]) -> None:
def __setitem__(self, index: slice, value: Iterable[T]) -> None: # pragma: no cover
...

def __setitem__(self, index: SupportsIndex | slice, value: Any) -> None:
Expand Down
2 changes: 1 addition & 1 deletion paramdb/_param_data/_dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def __setitem__(self, name: str, value: Any) -> None:

@property
@abstractmethod
def last_updated(self) -> datetime | None:
def last_updated(self) -> datetime | None: # pragma: no cover
...

def to_dict(self) -> dict[str, Any]:
Expand Down
99 changes: 97 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ astropy = ["astropy"]

[tool.poetry.group.dev.dependencies]
pytest = "^7.3.1"
pytest-cov = "^4.1.0"
flake8 = "^6.0.0"
pylint = "^2.17.4"
mypy = "^1.3.0"
Expand Down

0 comments on commit 7385067

Please sign in to comment.