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

Ignore RedisConnectionError and exclude TypeChecking blocks from coverage #620

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ concurrency = [
[tool.coverage.report]
# Regexes for lines to exclude from consideration
# See https://coverage.readthedocs.io/en/latest/excluding.html#excluding for more info
exclude_also = []
exclude_also = ["if TYPE_CHECKING:"]

skip_covered = true
show_missing = true
6 changes: 6 additions & 0 deletions tests/test_amap.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import uuid
from datetime import UTC, datetime

import pytest
import pytest_asyncio
from fastapi.testclient import TestClient

from app.core import models_core
from app.core.groups.groups_type import GroupType
from app.modules.amap import models_amap
from app.modules.amap.types_amap import AmapSlotType, DeliveryStatusType
from app.types.exceptions import RedisConnectionError
from tests.commons import (
add_object_to_db,
change_redis_client_status,
Expand Down Expand Up @@ -262,6 +264,7 @@ def test_make_delivery_orderable(client: TestClient) -> None:
assert response.status_code == 204


@pytest.mark.xfail(raises=RedisConnectionError)
def test_add_order_to_delivery(client: TestClient) -> None:
# Enable Redis client for locker
change_redis_client_status(activated=True)
Expand All @@ -287,6 +290,7 @@ def test_add_order_to_delivery(client: TestClient) -> None:
assert response.status_code == 201


@pytest.mark.xfail(raises=RedisConnectionError)
def test_edit_order(client: TestClient) -> None:
# Enable Redis client for locker
change_redis_client_status(activated=True)
Expand All @@ -313,6 +317,7 @@ def test_edit_order(client: TestClient) -> None:
assert response.status_code == 204


@pytest.mark.xfail(raises=RedisConnectionError)
def test_remove_order(client: TestClient) -> None:
# Enable Redis client for locker
change_redis_client_status(activated=True)
Expand All @@ -330,6 +335,7 @@ def test_remove_order(client: TestClient) -> None:
assert response.status_code == 204


@pytest.mark.xfail(raises=RedisConnectionError)
def test_remove_order_by_admin(client: TestClient) -> None:
# Enable Redis client for locker
change_redis_client_status(activated=True)
Expand Down
3 changes: 3 additions & 0 deletions tests/test_raffle.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import uuid
from pathlib import Path

import pytest
import pytest_asyncio
from fastapi.testclient import TestClient

from app.core import models_core
from app.core.groups.groups_type import GroupType
from app.modules.raffle import models_raffle
from app.modules.raffle.types_raffle import RaffleStatusType
from app.types.exceptions import RedisConnectionError
from tests.commons import (
add_object_to_db,
change_redis_client_status,
Expand Down Expand Up @@ -314,6 +316,7 @@ def test_get_tickets_by_user_id(client: TestClient) -> None:
assert len(response.json()) == 2


@pytest.mark.xfail(raises=RedisConnectionError)
def test_buy_tickets(client: TestClient) -> None:
# Enable Redis client for locker
change_redis_client_status(activated=True)
Expand Down
3 changes: 3 additions & 0 deletions tests/test_ratelimit.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import pytest
from fastapi.testclient import TestClient

from app.types.exceptions import RedisConnectionError
from tests.commons import change_redis_client_status, settings


@pytest.mark.xfail(raises=RedisConnectionError)
def test_limiter(client: TestClient) -> None:
change_redis_client_status(activated=True)
try:
Expand Down