-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Drop Python 3.8 support and upgrade tooling
- Loading branch information
1 parent
eedd103
commit c996a5c
Showing
9 changed files
with
69 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,9 +104,6 @@ ENV/ | |
# mypy | ||
.mypy_cache/ | ||
|
||
# .vscode | ||
.vscode/ | ||
|
||
# OS files | ||
.DS_Store | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"python.analysis.typeCheckingMode": "basic", | ||
"python.analysis.autoImportCompletions": true, | ||
"python.terminal.activateEnvironment": true, | ||
"python.terminal.activateEnvInCurrentTerminal": true, | ||
"python.testing.unittestEnabled": false, | ||
"python.testing.pytestEnabled": true, | ||
"editor.rulers": [88], | ||
"python.defaultInterpreterPath": "${workspaceFolder}/.hatch/fastapi-users-db-beanie/bin/python", | ||
"python.testing.pytestPath": "${workspaceFolder}/.hatch/fastapi-users-db-beanie/bin/pytest", | ||
"python.testing.cwd": "${workspaceFolder}", | ||
"python.testing.pytestArgs": ["--no-cov"], | ||
"[python]": { | ||
"editor.formatOnSave": true, | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll": "explicit", | ||
"source.organizeImports": "explicit" | ||
}, | ||
"editor.defaultFormatter": "charliermarsh.ruff" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
from typing import Any, AsyncGenerator, Dict, List, Optional | ||
from collections.abc import AsyncGenerator | ||
from typing import Any, Optional | ||
|
||
import pymongo.errors | ||
import pytest | ||
import pytest_asyncio | ||
from beanie import Document, PydanticObjectId, init_beanie | ||
from fastapi_users import InvalidID | ||
from motor.motor_asyncio import AsyncIOMotorClient, AsyncIOMotorDatabase | ||
|
@@ -24,10 +26,10 @@ class OAuthAccount(BaseOAuthAccount): | |
|
||
|
||
class UserOAuth(User): | ||
oauth_accounts: List[OAuthAccount] = Field(default_factory=list) | ||
oauth_accounts: list[OAuthAccount] = Field(default_factory=list) | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
@pytest_asyncio.fixture | ||
async def mongodb_client(): | ||
client = AsyncIOMotorClient( | ||
"mongodb://localhost:27017", | ||
|
@@ -44,7 +46,7 @@ async def mongodb_client(): | |
return | ||
|
||
|
||
@pytest.fixture | ||
@pytest_asyncio.fixture | ||
async def beanie_user_db( | ||
mongodb_client: AsyncIOMotorClient, | ||
) -> AsyncGenerator[BeanieUserDatabase, None]: | ||
|
@@ -56,7 +58,7 @@ async def beanie_user_db( | |
await mongodb_client.drop_database("test_database") | ||
|
||
|
||
@pytest.fixture | ||
@pytest_asyncio.fixture | ||
async def beanie_user_db_oauth( | ||
mongodb_client: AsyncIOMotorClient, | ||
) -> AsyncGenerator[BeanieUserDatabase, None]: | ||
|
@@ -71,7 +73,7 @@ async def beanie_user_db_oauth( | |
@pytest.mark.asyncio | ||
async def test_queries( | ||
beanie_user_db: BeanieUserDatabase[User], | ||
oauth_account1: Dict[str, Any], | ||
oauth_account1: dict[str, Any], | ||
): | ||
user_create = { | ||
"email": "[email protected]", | ||
|
@@ -194,8 +196,8 @@ async def test_queries_custom_fields( | |
@pytest.mark.asyncio | ||
async def test_queries_oauth( | ||
beanie_user_db_oauth: BeanieUserDatabase[UserOAuth], | ||
oauth_account1: Dict[str, Any], | ||
oauth_account2: Dict[str, Any], | ||
oauth_account1: dict[str, Any], | ||
oauth_account2: dict[str, Any], | ||
): | ||
user_create = { | ||
"email": "[email protected]", | ||
|