Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
6 changes: 3 additions & 3 deletions tests/e2e_tests/e2e_utils.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FILE_PATH = "pr_agent/cli_pip.py"
FILE_PATH: str = "pr_agent/cli_pip.py"

PR_HEADER_START_WITH = '### **User description**\nupdate cli_pip.py\n\n\n___\n\n### **PR Type**'
REVIEW_START_WITH = '## PR Reviewer Guide 🔍\n\n<table>\n<tr><td>⏱️&nbsp;<strong>Estimated effort to review</strong>:'
IMPROVE_START_WITH_REGEX_PATTERN = r'^## PR Code Suggestions ✨\n\n<!-- [a-z0-9]+ -->\n\n<table><thead><tr><td>Category</td>'

NUM_MINUTES = 5
NUM_MINUTES: int = 5

NEW_FILE_CONTENT = """\
NEW_FILE_CONTENT: str = """\
from pr_agent import cli
from pr_agent.config_loader import get_settings

Expand Down
16 changes: 11 additions & 5 deletions tests/health_test/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
setup_logger(log_level)


async def run_async():
async def run_async() -> None:
pr_url = os.getenv('TEST_PR_URL', 'https://github.com/Codium-ai/pr-agent/pull/1385')

get_settings().set("config.git_provider", "github")
Expand All @@ -30,7 +30,9 @@ async def run_async():
original_settings = copy.deepcopy(get_settings())
await agent.handle_request(pr_url, ['describe'])
pr_header_body = dict(get_settings().data)['artifact']
assert pr_header_body.startswith('###') and 'PR Type' in pr_header_body and 'Description' in pr_header_body
assert isinstance(pr_header_body, str), f"Expected artifact to be str, got {type(pr_header_body).__name__}"
assert pr_header_body.startswith('###') and 'PR Type' in pr_header_body and 'Description' in pr_header_body, \
"PR description artifact missing expected sections"
Comment on lines +34 to +35

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. pr_header_body uses single quotes 📘 Rule violation ⚙ Maintainability

New assertions in run_async() introduce single-quoted string literals (e.g., '###', '##', `'PR
Type', 'PR Reviewer Guide', 'PR Code Suggestions'`) where the repository Ruff style requires
double quotes. This can cause Ruff/pre-commit failures and inconsistent style across the codebase.
Agent Prompt
## Issue description
The newly added asserts in `run_async()` use single-quoted string literals, but the repo style requires double quotes per Ruff configuration.

## Issue Context
Update the new string literals in these asserts to use double quotes (e.g., replace `'###'`/`'##'` and labels like `'PR Type'`, `'PR Reviewer Guide'`, `'PR Code Suggestions'`, and related strings such as `'Description'` with their double-quoted equivalents).

## Fix Focus Areas
- tests/health_test/main.py[34-35]
- tests/health_test/main.py[45-46]
- tests/health_test/main.py[56-57]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

context['settings'] = copy.deepcopy(original_settings) # Restore settings state after each test to prevent test interference
get_logger().info("PR description generated successfully\n")

Expand All @@ -39,7 +41,9 @@ async def run_async():
original_settings = copy.deepcopy(get_settings())
await agent.handle_request(pr_url, ['review'])
pr_review_body = dict(get_settings().data)['artifact']
assert pr_review_body.startswith('##') and 'PR Reviewer Guide' in pr_review_body
assert isinstance(pr_review_body, str), f"Expected artifact to be str, got {type(pr_review_body).__name__}"
assert pr_review_body.startswith('##') and 'PR Reviewer Guide' in pr_review_body, \
"PR review artifact missing expected header"
context['settings'] = copy.deepcopy(original_settings) # Restore settings state after each test to prevent test interference
get_logger().info("PR review generated successfully\n")

Expand All @@ -48,7 +52,9 @@ async def run_async():
original_settings = copy.deepcopy(get_settings())
await agent.handle_request(pr_url, ['improve'])
pr_improve_body = dict(get_settings().data)['artifact']
assert pr_improve_body.startswith('##') and 'PR Code Suggestions' in pr_improve_body
assert isinstance(pr_improve_body, str), f"Expected artifact to be str, got {type(pr_improve_body).__name__}"
assert pr_improve_body.startswith('##') and 'PR Code Suggestions' in pr_improve_body, \
"PR improve artifact missing expected header"
context['settings'] = copy.deepcopy(original_settings) # Restore settings state after each test to prevent test interference
get_logger().info("PR improvements generated successfully\n")

Expand All @@ -59,7 +65,7 @@ async def run_async():
raise e


def run():
def run() -> None:
with request_cycle_context({}):
context['settings'] = copy.deepcopy(global_settings)
asyncio.run(run_async())
Expand Down
Loading