Skip to content

Commit 53a1b39

Browse files
authored
chore(deps): update pytest to 9.xx and add pytest-asyncio to fix some warnings in tests (#2222)
1 parent aa6854e commit 53a1b39

26 files changed

Lines changed: 85 additions & 55 deletions

pyproject.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,12 @@ lint.ignore = ["E999", "B008"]
7777
exclude_dirs = ["tests"]
7878
skips = ["B101"]
7979
tests = []
80+
81+
[tool.pytest.ini_options]
82+
asyncio_mode = "auto"
83+
testpaths = ["tests"]
84+
python_files = ["test_*.py"]
85+
python_classes = ["Test*"]
86+
python_functions = ["test_*"]
87+
addopts = "--color=yes"
88+
console_output_style = "progress"

requirements-dev.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
pytest==7.4.0
1+
pytest==9.0.2
2+
pytest-asyncio>=1.3.0
23
poetry
34
twine
45
pre-commit>=4,<5

requirements.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ litellm==1.77.7
1717
loguru==0.7.2
1818
msrest==0.7.1
1919
openai>=1.55.3
20-
pytest==7.4.0
20+
pytest==9.0.2
21+
pytest-asyncio>=1.3.0
2122
PyGithub==1.59.*
2223
PyYAML==6.0.1
2324
python-gitlab==3.15.0
@@ -28,7 +29,7 @@ ujson==5.8.0
2829
uvicorn==0.22.0
2930
tenacity==8.2.3
3031
gunicorn==23.0.0
31-
pytest-cov==5.0.0
32+
pytest-cov==7.0.0
3233
pydantic==2.8.2
3334
html2text==2024.2.26
3435
giteapy==1.0.8

tests/e2e_tests/langchain_ai_handler.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import asyncio
22
import os
33
import time
4+
45
from pr_agent.algo.ai_handlers.langchain_ai_handler import LangChainOpenAIHandler
56
from pr_agent.config_loader import get_settings
67

8+
79
def check_settings():
810
print('Checking settings...')
911
settings = get_settings()

tests/e2e_tests/test_bitbucket_app.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@
1111

1212
from pr_agent.config_loader import get_settings
1313
from pr_agent.log import get_logger, setup_logger
14-
from tests.e2e_tests.e2e_utils import (FILE_PATH,
15-
IMPROVE_START_WITH_REGEX_PATTERN,
16-
NEW_FILE_CONTENT, NUM_MINUTES,
17-
PR_HEADER_START_WITH, REVIEW_START_WITH)
14+
from tests.e2e_tests.e2e_utils import (
15+
FILE_PATH,
16+
IMPROVE_START_WITH_REGEX_PATTERN,
17+
NEW_FILE_CONTENT,
18+
NUM_MINUTES,
19+
PR_HEADER_START_WITH,
20+
REVIEW_START_WITH,
21+
)
1822

1923
log_level = os.environ.get("LOG_LEVEL", "INFO")
2024
setup_logger(log_level)
@@ -42,7 +46,7 @@ def test_e2e_run_bitbucket_app():
4246
target_repo = repo.branches.create(new_branch,source_branch.hash)
4347

4448
# Update the file content
45-
url = (f"https://api.bitbucket.org/2.0/repositories/{project_key}/{repo_slug}/src")
49+
url = f"https://api.bitbucket.org/2.0/repositories/{project_key}/{repo_slug}/src"
4650
files={FILE_PATH: NEW_FILE_CONTENT}
4751
data={
4852
"message": "update cli_pip.py",

tests/e2e_tests/test_gitea_app.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
import os
22
import time
3-
import requests
43
from datetime import datetime
54

5+
import requests
6+
67
from pr_agent.config_loader import get_settings
78
from pr_agent.log import get_logger, setup_logger
8-
from tests.e2e_tests.e2e_utils import (FILE_PATH,
9-
IMPROVE_START_WITH_REGEX_PATTERN,
10-
NEW_FILE_CONTENT, NUM_MINUTES,
11-
PR_HEADER_START_WITH, REVIEW_START_WITH)
9+
from tests.e2e_tests.e2e_utils import (
10+
FILE_PATH,
11+
IMPROVE_START_WITH_REGEX_PATTERN,
12+
NEW_FILE_CONTENT,
13+
NUM_MINUTES,
14+
PR_HEADER_START_WITH,
15+
REVIEW_START_WITH,
16+
)
1217

1318
log_level = os.environ.get("LOG_LEVEL", "INFO")
1419
setup_logger(log_level)

tests/e2e_tests/test_github_app.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@
66
from pr_agent.config_loader import get_settings
77
from pr_agent.git_providers import get_git_provider
88
from pr_agent.log import get_logger, setup_logger
9-
from tests.e2e_tests.e2e_utils import (FILE_PATH,
10-
IMPROVE_START_WITH_REGEX_PATTERN,
11-
NEW_FILE_CONTENT, NUM_MINUTES,
12-
PR_HEADER_START_WITH, REVIEW_START_WITH)
9+
from tests.e2e_tests.e2e_utils import (
10+
FILE_PATH,
11+
IMPROVE_START_WITH_REGEX_PATTERN,
12+
NEW_FILE_CONTENT,
13+
NUM_MINUTES,
14+
PR_HEADER_START_WITH,
15+
REVIEW_START_WITH,
16+
)
1317

1418
log_level = os.environ.get("LOG_LEVEL", "INFO")
1519
setup_logger(log_level)

tests/e2e_tests/test_gitlab_webhook.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@
88
from pr_agent.config_loader import get_settings
99
from pr_agent.git_providers import get_git_provider
1010
from pr_agent.log import get_logger, setup_logger
11-
from tests.e2e_tests.e2e_utils import (FILE_PATH,
12-
IMPROVE_START_WITH_REGEX_PATTERN,
13-
NEW_FILE_CONTENT, NUM_MINUTES,
14-
PR_HEADER_START_WITH, REVIEW_START_WITH)
11+
from tests.e2e_tests.e2e_utils import (
12+
FILE_PATH,
13+
IMPROVE_START_WITH_REGEX_PATTERN,
14+
NEW_FILE_CONTENT,
15+
NUM_MINUTES,
16+
PR_HEADER_START_WITH,
17+
REVIEW_START_WITH,
18+
)
1519

1620
log_level = os.environ.get("LOG_LEVEL", "INFO")
1721
setup_logger(log_level)

tests/health_test/main.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44
import os
55
from pathlib import Path
66

7-
from starlette_context import request_cycle_context, context
7+
from starlette_context import context, request_cycle_context
88

9+
from pr_agent.agent.pr_agent import PRAgent, commands
910
from pr_agent.cli import run_command
1011
from pr_agent.config_loader import get_settings, global_settings
11-
12-
from pr_agent.agent.pr_agent import PRAgent, commands
1312
from pr_agent.log import get_logger, setup_logger
1413
from tests.e2e_tests import e2e_utils
1514

tests/unittest/test_add_docs_trigger.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import pytest
2-
from pr_agent.servers.github_app import handle_new_pr_opened
3-
from pr_agent.tools.pr_add_docs import PRAddDocs
2+
43
from pr_agent.agent.pr_agent import PRAgent
54
from pr_agent.config_loader import get_settings
6-
from pr_agent.identity_providers.identity_provider import Eligibility
75
from pr_agent.identity_providers import get_identity_provider
6+
from pr_agent.identity_providers.identity_provider import Eligibility
7+
from pr_agent.servers.github_app import handle_new_pr_opened
8+
from pr_agent.tools.pr_add_docs import PRAddDocs
89

910

1011
@pytest.mark.asyncio

0 commit comments

Comments
 (0)