utils: update ruff to v0.16.0 and align code - #5825
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: rkishner <rkishner@redhat.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
📝 WalkthroughWalkthroughThe PR updates the Ruff pre-commit revision and reformats several Python string and assertion expressions. Generated shell and PowerShell command content remains unchanged, while the assertion failure message no longer uses a trailing comma. ChangesFormatting and tooling updates
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (1 error)
✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Report bugs in Issues Welcome! 🎉This pull request will be automatically processed with the following features: 🔄 Automatic Actions
📋 Available CommandsPR Status Management
Review & Approval
Testing & Validation
Container Operations
Cherry-pick Operations
Branch Management
Label Management
✅ Merge RequirementsThis PR will be automatically approved when the following conditions are met:
📊 Review ProcessApprovers and ReviewersApprovers:
Reviewers:
Available Labels
AI Features
Security Checks
💡 Tips
📌 Additional InformationCustom Commands:
For more information, please refer to the project documentation or contact the maintainers. |
|
/verified |
Test execution plan request detailsCRITICAL: You MUST post an inline review comment on the first changed line of the first file. As an expert software testing engineer, analyze all modified files in this PR and create a targeted test execution plan. Analysis Requirements:
Output rules: Your deliverable: Test Execution Plan
Use these formats:
Real test commands (MANDATORY when changes affect session/runtime code): When the affected code runs at session/collection time (conftest fixtures, pytest plugins,
Example output for a session-startup fix: Guidelines:
Hardware-Related Checks (SR-IOV, GPU, DPDK): When PR modifies fixtures for hardware-specific resources:
CRITICAL WORKFLOW COMPLETION RULES: When responding to this test execution plan request, you MUST follow these rules EXACTLY:
ABSOLUTE PROHIBITIONS (violating these creates empty/meaningless reviews):
Remember: The pull request review is visible to users. Additional comments are redundant noise. CRITICAL — Verification rules for smoke and gating decisions: |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '== PR metadata =='
gh pr view 5825 --json headRefOid,baseRefOid,files --jq '{headRefOid, baseRefOid, files: [.files[].path]}'
echo '== Changed hunks =='
git diff --find-renames --unified=0 HEAD^ HEAD -- \
.pre-commit-config.yaml \
tests/network/bgp/evpn/libevpn.py \
tests/network/flat_overlay/utils.py \
tests/network/libs/stuntime.py \
tests/observability/metrics/utils.py \
tests/virt/cluster/common_templates/general/test_base_template.py \
tests/virt/cluster/common_templates/windows/test_windows_custom_options.py
echo '== Enclosing structures in changed Python files =='
for f in \
tests/network/bgp/evpn/libevpn.py \
tests/network/flat_overlay/utils.py \
tests/network/libs/stuntime.py \
tests/observability/metrics/utils.py \
tests/virt/cluster/common_templates/general/test_base_template.py \
tests/virt/cluster/common_templates/windows/test_windows_custom_options.py
do
echo "-- $f"
ast-grep outline "$f" --items all --type function,method,class 2>/dev/null || true
done
echo '== Direct call/import candidates for changed helpers =='
rg -n -C2 --glob '*.py' \
'\b(_build_bridge_commands|start_nc_response_on_vm|ContinuousPing|expected_metric_labels_and_values|test_base_templates_annotations|initialize_and_format_windows_drive)\b' \
tests conftest.py 2>/dev/null || true
echo '== Smoke and gating marker files =='
echo '-- smoke'
rg -l '`@pytest`\.mark\.smoke' tests || true
echo '-- gating'
rg -l '`@pytest`\.mark\.gating' tests || trueLength of output: 2389 🏁 Script executed: #!/bin/bash
set -u
echo '== PR diff from GitHub =='
gh pr diff 5825 --color=never || true
echo '== Structural map of changed Python files =='
for f in \
tests/network/bgp/evpn/libevpn.py \
tests/network/flat_overlay/utils.py \
tests/network/libs/stuntime.py \
tests/observability/metrics/utils.py \
tests/virt/cluster/common_templates/general/test_base_template.py \
tests/virt/cluster/common_templates/windows/test_windows_custom_options.py
do
echo "-- $f"
ast-grep outline "$f" --items all --type function,method,class 2>/dev/null || true
done
echo '== Calls/imports in tests and conftest files =='
rg -n -C3 --glob '*.py' \
'\b(_build_bridge_commands|start_nc_response_on_vm|ContinuousPing|expected_metric_labels_and_values|initialize_and_format_windows_drive)\b' \
tests || true
echo '== Same-file wrappers/callers of changed helpers =='
for f in tests/network/bgp/evpn/libevpn.py tests/network/flat_overlay/utils.py tests/network/libs/stuntime.py tests/observability/metrics/utils.py
do
echo "-- $f"
rg -n -C3 '\b(_build_bridge_commands|start_nc_response_on_vm|ContinuousPing|expected_metric_labels_and_values)\b' "$f" || true
done
echo '== Fixtures/context managers referencing changed helpers =='
rg -n -U -C3 --glob '*.py' \
'(`@pytest`\.fixture|`@contextmanager`|yield from|yield).*\n|(_build_bridge_commands|start_nc_response_on_vm|ContinuousPing|expected_metric_labels_and_values)' \
tests/**/conftest.py tests 2>/dev/null || true
echo '== Smoke-marked files =='
rg -l '`@pytest`\.mark\.smoke' tests || true
echo '== Gating-marked files =='
rg -l '`@pytest`\.mark\.gating' tests || trueLength of output: 167005 🏁 Script executed: #!/bin/bash
set -u
echo '== Diff with line context only =='
gh pr diff 5825 --color=never | sed -n '/^diff --git /,/^diff --git /p' | \
grep -E '^(diff --git|@@|[+-][^+-])' || true
echo '== Exact symbol references (paths and context) =='
for symbol in _build_bridge_commands ContinuousPing measure_stuntime start_nc_response_on_vm expected_metric_labels_and_values initialize_and_format_windows_drive
do
echo "-- $symbol"
rg -n -C4 --glob '*.py' "\\b${symbol}\\b" tests || true
done
echo '== Relevant test definitions, fixture dependencies, and markers =='
for f in \
tests/network/flat_overlay/test_flat_overlay.py \
tests/virt/cluster/common_templates/general/test_base_template.py \
tests/virt/cluster/common_templates/windows/test_windows_custom_options.py
do
echo "-- $f"
rg -n -C3 '`@pytest`\.mark|^class Test|^\s*def test_|vmc_nc_connection_initialization|ContinuousPing|measure_stuntime|expected_metric_labels_and_values|initialize_and_format_windows_drive' "$f" || true
done
echo '== EVPN test subtree references and markers =='
rg -n -C4 --glob '*.py' \
'(_build_bridge_commands|build_bridge_commands|libevpn|`@pytest`\.mark\.(smoke|gating)|^class Test|^\s*def test_)' \
tests/network/bgp/evpn || true
echo '== ContinuousPing consumers and their markers =='
for f in $(rg -l --glob '*.py' '\b(ContinuousPing|measure_stuntime)\b' tests | grep -v '^tests/network/libs/stuntime.py$'); do
echo "-- $f"
rg -n -C4 '`@pytest`\.mark\.(smoke|gating)|^class Test|^\s*def test_|ContinuousPing|measure_stuntime' "$f"
done
echo '== Smoke-marker intersection with relevant path ancestry =='
for f in $(rg -l '`@pytest`\.mark\.smoke' tests); do
printf '%s: ' "$f"
for symbol in _build_bridge_commands ContinuousPing measure_stuntime start_nc_response_on_vm expected_metric_labels_and_values initialize_and_format_windows_drive; do
if rg -q "\b${symbol}\b" "$f"; then printf '%s ' "$symbol"; fi
done
echo
doneLength of output: 65914 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '== First changed file, current line numbers =='
nl -ba .pre-commit-config.yaml | sed -n '12,22p'
echo '== Flat-overlay tests that consume changed fixture =='
rg -n -C5 '\bvmc_nc_connection_initialization\b|^\s*def test_' tests/network/flat_overlay/test_flat_overlay.py
echo '== EVPN fixture chain to public bridge deployment function =='
rg -n -C5 '\b(deploy_evpn_l2_endpoint|deploy_evpn_l3_endpoint|external_l2_endpoint|external_l3_endpoint|vm_source_provider)\b' \
tests/network/bgp/evpn/conftest.py \
tests/network/bgp/evpn/test_evpn_connectivity.py
echo '== CDI metrics test definition and markers =='
rg -n -C5 '`@pytest`\.mark|^\s*def test_|\bexpected_metric_labels_and_values\b' \
tests/observability/metrics/test_cdi_metrics.py
echo '== Exact test functions in stuntime consumer modules =='
rg -n '^\s*def test_' \
tests/network/l2_bridge/migration_stuntime/test_migration_stuntime.py \
tests/network/localnet/migration_stuntime/test_migration_stuntime.pyLength of output: 1457 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '== Inline anchor =='
cat -n .pre-commit-config.yaml | sed -n '14,21p'
head_sha="15fd620f14939fda94913be6832b12b26f2dee25"
body=$(cat <<'EOF'
## Test Execution Plan
**Run smoke tests: False** — verified smoke-marked files exist, but none imports or reaches the changed helpers; no smoke-suite `conftest.py` references them.
**Run gating tests: True**
- `tests/network/flat_overlay/test_flat_overlay.py` (gating) reaches `tests/network/flat_overlay/conftest.py::vmc_nc_connection_initialization` → `tests/network/flat_overlay/utils.py::start_nc_response_on_vm`.
- `tests/virt/cluster/common_templates/general/test_base_template.py::test_base_templates_annotations` is directly changed and marked `gating`.
**Affected tests to run**
- `tests/network/bgp/evpn/test_evpn_connectivity.py::test_stretched_l2_connectivity_udn_vm_and_external_provider`
- `tests/network/bgp/evpn/test_evpn_connectivity.py::test_stretched_l2_connectivity_is_preserved_over_live_migration`
- `tests/network/bgp/evpn/test_evpn_connectivity.py::test_routed_l3_connectivity_udn_vm_and_external_provider`
- `tests/network/bgp/evpn/test_evpn_connectivity.py::test_routed_l3_connectivity_is_preserved_over_live_migration`
- `tests/network/bgp/evpn/test_evpn_connectivity.py::test_connectivity_after_udn_vm_cold_reboot`
- `tests/network/bgp/evpn/test_evpn_connectivity.py::test_source_provider_migration`
(external-endpoint fixtures → `deploy_evpn_l2_endpoint` / `deploy_evpn_l3_endpoint` → `_build_bridge_commands`)
- `tests/network/flat_overlay/test_flat_overlay.py` (gating; `vmc_nc_connection_initialization` → `start_nc_response_on_vm`)
- `tests/network/l2_bridge/migration_stuntime/test_migration_stuntime.py` (tier3; `l2_bridge_active_ping` yield fixture → `ContinuousPing.stop`)
- `tests/network/localnet/migration_stuntime/test_migration_stuntime.py` (tier3; `active_ping` yield fixture → `ContinuousPing.stop`)
- `tests/observability/metrics/test_cdi_metrics.py::test_metric_kubevirt_cdi_storageprofile_info`
- `tests/virt/cluster/common_templates/general/test_base_template.py::test_base_templates_annotations` (gating)
- `tests/virt/cluster/common_templates/windows/test_windows_custom_options.py::TestCustomWindowsOptions::test_windows_custom_options_initialize_disk`
**Real tests (cluster required)**
Error/fix path: `pytest tests/network/flat_overlay/test_flat_overlay.py -k connection_response`
Expected: the VM starts the netcat response loop and the peer receives all expected HTTP-success responses.
Happy path: `pytest tests/network/l2_bridge/migration_stuntime/test_migration_stuntime.py -k test_client_migrates_between_non_server_nodes`
Expected: migration completes and continuous-ping shutdown/reporting completes within the stuntime threshold.
EOF
)
gh api --method POST \
"repos/RedHatQE/openshift-virtualization-tests/pulls/5825/comments" \
-f body="$body" \
-f commit_id="$head_sha" \
-f path=".pre-commit-config.yaml" \
-F line=19 \
-f side="RIGHT" \
--jq '{id, path, line, side}'Length of output: 3591
|
What this PR does / why we need it:
updates: github.com/astral-sh/ruff-pre-commit: v0.15.22 → v0.16.0
Change all unparenthesized implicit string concatenation in collection to have parentheses.
Which issue(s) this PR fixes:
#5797
Special notes for reviewer:
jira-ticket:
Summary by CodeRabbit