Skip to content

Commit 87eec41

Browse files
authored
Update multiple version dependency specifiers (#454)
1 parent 0e7cef5 commit 87eec41

File tree

7 files changed

+227
-216
lines changed

7 files changed

+227
-216
lines changed

backend/app/admin/tests/api_v1/test_auth.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22
# -*- coding: utf-8 -*-
33
from starlette.testclient import TestClient
44

5-
from backend.core.conf import settings
6-
75

86
def test_logout(client: TestClient, token_headers: dict[str, str]) -> None:
9-
response = client.post(f'{settings.FASTAPI_API_V1_PATH}/auth/logout', headers=token_headers)
7+
response = client.post('/auth/logout', headers=token_headers)
108
assert response.status_code == 200
119
assert response.json()['code'] == 200

backend/app/admin/tests/conftest.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,41 @@
11
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
3-
from typing import Dict, Generator
3+
from typing import Generator
44

55
import pytest
66

77
from starlette.testclient import TestClient
88

99
from backend.app.admin.tests.utils.db_mysql import override_get_db
10-
from backend.app.admin.tests.utils.get_headers import get_token_headers
10+
from backend.core.conf import settings
1111
from backend.database.db_mysql import get_db
1212
from backend.main import app
1313

14+
# 重载数据库
1415
app.dependency_overrides[get_db] = override_get_db
1516

1617

17-
# Test user
18+
# Test data
1819
PYTEST_USERNAME = 'admin'
1920
PYTEST_PASSWORD = '123456'
21+
PYTEST_BASE_URL = f'http://testserver{settings.FASTAPI_API_V1_PATH}'
2022

2123

2224
@pytest.fixture(scope='module')
2325
def client() -> Generator:
24-
with TestClient(app) as c:
26+
with TestClient(app, base_url=PYTEST_BASE_URL) as c:
2527
yield c
2628

2729

2830
@pytest.fixture(scope='module')
29-
def token_headers(client: TestClient) -> Dict[str, str]:
30-
return get_token_headers(client=client, username=PYTEST_USERNAME, password=PYTEST_PASSWORD)
31+
def token_headers(client: TestClient) -> dict[str, str]:
32+
params = {
33+
'username': PYTEST_USERNAME,
34+
'password': PYTEST_PASSWORD,
35+
}
36+
response = client.post('/auth/login/swagger', params=params)
37+
response.raise_for_status()
38+
token_type = response.json()['token_type']
39+
access_token = response.json()['access_token']
40+
headers = {'Authorization': f'{token_type} {access_token}'}
41+
return headers

backend/app/admin/tests/utils/db_mysql.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@
55
from backend.core.conf import settings
66
from backend.database.db_mysql import create_engine_and_session
77

8-
TEST_SQLALCHEMY_DATABASE_URL = (
8+
_, test_async_db_session = create_engine_and_session(
99
f'mysql+asyncmy://{settings.MYSQL_USER}:{settings.MYSQL_PASSWORD}@{settings.MYSQL_HOST}:'
1010
f'{settings.MYSQL_PORT}/{settings.MYSQL_DATABASE}_test?charset={settings.MYSQL_CHARSET}'
1111
)
1212

13-
_, test_async_db_session = create_engine_and_session(TEST_SQLALCHEMY_DATABASE_URL)
14-
1513

1614
async def override_get_db() -> AsyncSession:
1715
"""session 生成器"""

backend/app/admin/tests/utils/get_headers.py

Lines changed: 0 additions & 17 deletions
This file was deleted.

backend/pyproject.toml

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,59 +12,59 @@ readme = "README.md"
1212
license = { text = "MIT" }
1313
requires-python = ">=3.10,<3.13"
1414
dependencies = [
15-
"alembic>=1.13.0",
15+
"alembic>=1.14.0",
1616
"asgiref>=3.8.0",
17-
"asyncmy==0.2.9",
18-
"bcrypt==4.0.1",
19-
"casbin==1.34.0",
20-
"casbin_async_sqlalchemy_adapter==1.4.0",
17+
"asyncmy>=0.2.9",
18+
"bcrypt>=4.2.0",
19+
"casbin>=1.36.0",
20+
"casbin_async_sqlalchemy_adapter>=1.6.0",
2121
"celery==5.3.6",
22-
"cryptography==41.0.7",
23-
"fast-captcha==0.3.2",
22+
"cryptography>=43.0.0",
23+
"fast-captcha>=0.3.2",
2424
"fastapi[all]==0.111.0",
25-
"fastapi-limiter==0.1.6",
25+
"fastapi-limiter>=0.1.6",
2626
"fastapi-pagination==0.12.13",
27-
"gunicorn==21.2.0",
28-
"httpx==0.25.2",
29-
"itsdangerous==2.1.2",
30-
"loguru==0.7.2",
31-
"msgspec==0.18.5",
32-
"passlib==1.7.4",
33-
"path==15.1.2",
34-
"phonenumbers==8.13.27",
35-
"psutil==5.9.6",
36-
"pydantic==2.9.1",
37-
"pytest==7.2.2",
38-
"pytest-pretty==1.2.0",
39-
"python-jose==3.3.0",
40-
"redis[hiredis]==5.1.0",
41-
"SQLAlchemy==2.0.30",
27+
"itsdangerous>=2.2.0",
28+
"loguru>=0.7.2",
29+
"msgspec>=0.18.6",
30+
"passlib>=1.7.4",
31+
"path==17.0.0",
32+
"phonenumbers>=8.13.0",
33+
"psutil>=6.0.0",
34+
"pydantic>=2.9.1",
35+
"python-jose>=3.3.0",
36+
"redis[hiredis]>=5.2.0",
37+
"SQLAlchemy>=2.0.30",
4238
"user-agents==2.2.0",
43-
"uvicorn[standard]==0.29.0",
44-
"XdbSearchIP==1.0.2",
39+
"XdbSearchIP>=1.0.2",
4540
"fastapi_oauth20>=0.0.1a2",
46-
"flower==2.0.1",
41+
"flower>=2.0.0",
4742
"sqlalchemy-crud-plus==1.6.0",
48-
"jinja2==3.1.4",
49-
"aiofiles==24.1.0",
43+
"jinja2>=3.1.4",
44+
"aiofiles>=24.1.0",
5045
# When celery version < 6.0.0
5146
# https://github.com/celery/celery/issues/7874
52-
"celery-aio-pool==0.1.0rc6",
47+
"celery-aio-pool==0.1.0rc7",
5348
"asgi-correlation-id>=4.3.3",
5449
"python-socketio[asyncio]>=5.11.4",
5550
]
5651

5752
[dependency-groups]
53+
dev = [
54+
"pytest>=8.0.0",
55+
"pytest-sugar>=1.0.0",
56+
]
5857
lint = [
5958
"ruff>=0.7.0",
6059
"pre-commit>=4.0.0",
6160
]
6261
server = [
62+
"gunicorn==21.2.0",
6363
"supervisor>=4.2.5",
6464
"wait-for-it>=2.2.2",
6565
]
6666

6767
[tool.uv]
6868
package = false
6969
python-downloads = "manual"
70-
default-groups = ['lint']
70+
default-groups = ["dev", "lint"]

backend/requirements.txt

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,30 @@
11
# This file was autogenerated by uv via the following command:
22
# uv export --directory backend -o requirements.txt --no-hashes
33
aiofiles==24.1.0
4-
alembic==1.13.3
4+
alembic==1.14.0
55
amqp==5.2.0
66
annotated-types==0.7.0
77
anyio==4.6.0
88
asgi-correlation-id==4.3.3
99
asgiref==3.8.1
1010
async-timeout==4.0.3 ; python_full_version < '3.11.3'
1111
asyncmy==0.2.9
12-
attrs==24.2.0
13-
bcrypt==4.0.1
12+
bcrypt==4.2.0
1413
bidict==0.23.1
1514
billiard==4.2.1
16-
casbin==1.34.0
17-
casbin-async-sqlalchemy-adapter==1.4.0
15+
casbin==1.36.3
16+
casbin-async-sqlalchemy-adapter==1.6.0
1817
celery==5.3.6
19-
celery-aio-pool==0.1.0rc6
18+
celery-aio-pool==0.1.0rc7
2019
certifi==2024.8.30
21-
cffi==1.17.1
20+
cffi==1.17.1 ; platform_python_implementation != 'PyPy'
2221
cfgv==3.4.0
2322
click==8.1.7
2423
click-didyoumean==0.3.1
2524
click-plugins==1.1.1
2625
click-repl==0.3.0
2726
colorama==0.4.6 ; sys_platform == 'win32' or platform_system == 'Windows'
28-
cryptography==41.0.7
27+
cryptography==43.0.3
2928
distlib==0.3.9
3029
dnspython==2.7.0
3130
ecdsa==0.19.0
@@ -40,7 +39,6 @@ fastapi-pagination==0.12.13
4039
filelock==3.16.1
4140
flower==2.0.1
4241
greenlet==3.1.1 ; platform_machine == 'AMD64' or platform_machine == 'WIN32' or platform_machine == 'aarch64' or platform_machine == 'amd64' or platform_machine == 'ppc64le' or platform_machine == 'win32' or platform_machine == 'x86_64'
43-
gunicorn==21.2.0
4442
h11==0.14.0
4543
hiredis==3.0.0
4644
httpcore==1.0.6
@@ -50,37 +48,37 @@ humanize==4.11.0
5048
identify==2.6.1
5149
idna==3.10
5250
iniconfig==2.0.0
53-
itsdangerous==2.1.2
51+
itsdangerous==2.2.0
5452
jinja2==3.1.4
5553
kombu==5.4.2
5654
loguru==0.7.2
5755
mako==1.3.5
5856
markdown-it-py==3.0.0
5957
markupsafe==3.0.1
6058
mdurl==0.1.2
61-
msgspec==0.18.5
59+
msgspec==0.18.6
6260
nodeenv==1.9.1
6361
orjson==3.10.7
6462
packaging==24.1
6563
passlib==1.7.4
66-
path==15.1.2
64+
path==17.0.0
6765
phonenumbers==8.13.27
6866
pillow==10.4.0
6967
platformdirs==4.3.6
7068
pluggy==1.5.0
7169
pre-commit==4.0.1
7270
prometheus-client==0.21.0
7371
prompt-toolkit==3.0.48
74-
psutil==5.9.6
72+
psutil==6.1.0
7573
pyasn1==0.6.1
76-
pycparser==2.22
74+
pycparser==2.22 ; platform_python_implementation != 'PyPy'
7775
pydantic==2.9.1
7876
pydantic-core==2.23.3
7977
pydantic-extra-types==2.9.0
8078
pydantic-settings==2.5.2
8179
pygments==2.18.0
82-
pytest==7.2.2
83-
pytest-pretty==1.2.0
80+
pytest==8.3.3
81+
pytest-sugar==1.0.0
8482
python-dateutil==2.9.0.post0
8583
python-dotenv==1.0.1
8684
python-engineio==4.9.1
@@ -89,7 +87,7 @@ python-multipart==0.0.12
8987
python-socketio==5.11.4
9088
pytz==2024.2
9189
pyyaml==6.0.2
92-
redis==5.1.0
90+
redis==5.2.0
9391
rich==13.9.2
9492
rsa==4.9
9593
ruff==0.7.2
@@ -101,6 +99,7 @@ sniffio==1.3.1
10199
sqlalchemy==2.0.30
102100
sqlalchemy-crud-plus==1.6.0
103101
starlette==0.37.2
102+
termcolor==2.5.0
104103
tomli==2.0.2 ; python_full_version < '3.11'
105104
tornado==6.4.1
106105
typer==0.12.5

0 commit comments

Comments
 (0)