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

gh-205 gh-128 gh-68 Upgrade Python to 3.12, Supertokens to 9.0.2 and all backend dependencies #211

Merged
merged 16 commits into from
Jun 2, 2024
Prev Previous commit
Next Next commit
code formatting
Tiendil committed Jun 2, 2024
commit cef72afc0e3e2ab43d696aaf88aaa8860b946185
5 changes: 1 addition & 4 deletions ffun/ffun/conftest.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import asyncio
from typing import AsyncGenerator, Generator
from typing import AsyncGenerator

import fastapi
import pytest
import pytest_asyncio

from ffun.application import application
@@ -15,7 +13,6 @@
from ffun.openai.tests.fixtures import * # noqa
from ffun.users.tests.fixtures import * # noqa


# Replacing the event_loop fixture with a custom implementation is deprecated
# and will lead to errors in the future.
# If you want to request an asyncio event loop with a scope other than function
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
add-title-and-description
"""

from typing import Any

from psycopg import Connection
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
add-feeds-links
"""

from typing import Any

from psycopg import Connection
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
migrate_to_processors_queue
"""

import uuid
from typing import Any

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
entries_table
"""

from typing import Any

from psycopg import Connection
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
fix-entries-unique-index
"""

from typing import Any

from psycopg import Connection
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
processed-state
"""

from typing import Any

from psycopg import Connection
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
remove-duplicated-entries-from-feeds
"""

from typing import Any

from psycopg import Connection
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
markers-tables
"""

from typing import Any

from psycopg import Connection
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
unity-duplicated-feeds
"""

from typing import Any

from psycopg import Connection
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
rename-tags-names-to-uid
"""

from typing import Any

from psycopg import Connection
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
tags-relationship-processor-tracking
"""

from typing import Any

from psycopg import Connection
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
tags-properties
"""

from typing import Any

from psycopg import Connection
14 changes: 4 additions & 10 deletions ffun/ffun/openai/tests/test_keys_statuses.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import datetime
from typing import Type
from unittest.mock import MagicMock

import openai
import pytest
from pytest_mock import MockerFixture
from unittest.mock import MagicMock

from ffun.openai.entities import KeyStatus
from ffun.openai.keys_statuses import Statuses, track_key_status
@@ -60,24 +60,18 @@ def test_works(self, statuses: Statuses) -> None:

assert statuses.get("key_1") == KeyStatus.works

@pytest.mark.parametrize(
"exception", [openai.AuthenticationError, openai.PermissionDeniedError]
)
@pytest.mark.parametrize("exception", [openai.AuthenticationError, openai.PermissionDeniedError])
def test_authentication_error(self, exception: Type[Exception], statuses: Statuses) -> None:
with pytest.raises(exception):
with track_key_status("key_1", statuses):
raise exception(message="test-message",
response=MagicMock(),
body=MagicMock())
raise exception(message="test-message", response=MagicMock(), body=MagicMock())

assert statuses.get("key_1") == KeyStatus.broken

@pytest.mark.parametrize("exception", [openai.RateLimitError])
def test_quota_error(self, exception: Type[Exception], statuses: Statuses) -> None:
with pytest.raises(exception):
with track_key_status("key_1", statuses):
raise exception(message="test-message",
response=MagicMock(),
body=MagicMock())
raise exception(message="test-message", response=MagicMock(), body=MagicMock())

assert statuses.get("key_1") == KeyStatus.quota
6 changes: 3 additions & 3 deletions ffun/ffun/parsers/tests/make.py
Original file line number Diff line number Diff line change
@@ -23,8 +23,8 @@ def fake_entry_info(**kwargs: Any) -> EntryInfo:
body=fake_body() if "body" not in kwargs else kwargs["body"],
external_id=uuid.uuid4().hex if "external_id" not in kwargs else kwargs["external_id"],
external_url=fake_url() if "external_url" not in kwargs else kwargs["external_url"],
external_tags={uuid.uuid4().hex, uuid.uuid4().hex}
if "external_tags" not in kwargs
else kwargs["external_tags"],
external_tags=(
{uuid.uuid4().hex, uuid.uuid4().hex} if "external_tags" not in kwargs else kwargs["external_tags"]
),
published_at=utils.now() if "published_at" not in kwargs else kwargs["published_at"],
)
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
resources-table
"""

from typing import Any

from psycopg import Connection
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
scores-tables
"""

from typing import Any

from psycopg import Connection
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
settings-table
"""

from typing import Any

from psycopg import Connection
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
index-to-search-by-value
"""

from typing import Any

from psycopg import Connection
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
users-mapping
"""

from typing import Any

from psycopg import Connection