Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abstract delete in repositories #12

Merged
merged 6 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
__pycache__
.coverage
.idea/
README.md
Dockerfile
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
run: docker-compose build meldingen-core

- name: Test
run: docker-compose run --rm meldingen-core pytest -v
run: docker-compose run --rm meldingen-core pytest --cov --cov-fail-under=100 -v
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
__pycache__/
.idea/
.coverage
3 changes: 2 additions & 1 deletion meldingen_core/repositories.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ async def list(self, *, limit: int | None = None, offset: int | None = None) ->
async def retrieve(self, pk: int) -> T_co | None:
...

@abstractmethod
async def delete(self, pk: int) -> None:
raise NotImplemented
...


class BaseMeldingRepository(BaseRepository[Melding, Melding], metaclass=ABCMeta):
Expand Down
298 changes: 191 additions & 107 deletions poetry.lock

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ mkdocs-material = "^9.5.6"
mkdocs-literate-nav = "^0.6.1"
pytest-asyncio = "^0.23.5"
pytest-mock = "^3.12.0"
pytest-cov = "^4.1.0"

[build-system]
requires = ["poetry-core"]
Expand All @@ -41,3 +42,6 @@ exclude = '''
profile = "black"
line_length = 120
known_first_party = ["meldingen_core"]

[tool.coverage.report]
exclude_lines = ["@abstractmethod", "pragma: no cover"]
3 changes: 3 additions & 0 deletions tests/test_actions/test_melding_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ async def list(self, *, limit: int | None = None, offset: int | None = None) ->
async def retrieve(self, pk: int) -> Melding | None:
return None

async def delete(self, pk: int) -> None: # pragma: no cover
return None

mocked_repository = MockMeldingRepository()
return mocked_repository

Expand Down