Repository navigation
BUILD-13853 Normalize assertion operand order in buildinfo tests - #444
sonarqube-agent[bot] wants to merge 1 commit into
Conversation
Fixed issues: - AaHFoFMIdm1Pkabk67fc for python:S3415 rule - AaHFoFMIdm1Pkabk67fb for python:S3415 rule - AaHFoFMIdm1Pkabk67fd for python:S3415 rule Generated by SonarQube Agent (task: c5e23bc3-185e-4e64-a8b9-52c6a94e214c)
Code Review ✅ Approved 🟢 Low riskSwapping equality assertion operands in test_buildinfo.py improves test readability without changing runtime behavior or the values the tests assert. Swaps operands in three test_buildinfo.py assertions so actual values come first and expected values second, matching the file's convention. No issues found. Verification Rules 1/2 met PRs 1 inspectedRules 1 failed 1 passed 2 not applicable
Functional validation No results Broader impact PRs 1 inspectedCross-PR 1 PR inspected 0 open impacts
Auto-approval Not enabledFor more verification details, comment OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar |
|



Fixed three SonarQube S3415 violations in test_buildinfo.py by swapping assertion operands to place actual values first and expected values second. This standardizes the assertion convention throughout the file, improving readability and maintainability.
View Project in SonarCloud
Fixed Issues
python:S3415 - Swap these 2 operands so the actual value comes first, to match the rest of this file. • MAJOR • View issue
Location:
main/tests/utils/test_buildinfo.py:47Why is this an issue?
Assertions check that the code under test produces the expected results. When you write an equality assertion, one operand is the value from the code under test (the actual value) and the other is what you expect (the expected value).
What changed
Swaps the operands of the get_package() assertion so the actual value, build_info_with_artefacts.get_package(), sits on the left and the expected literal 'org.sonarsource.test' on the right. This matches the actual-first convention used elsewhere in the file. The neighbouring artifacts assertion is flipped the same way to keep the file consistent.
python:S3415 - Swap these 2 operands so the actual value comes first, to match the rest of this file. • MAJOR • View issue
Location:
main/tests/utils/test_buildinfo.py:51Why is this an issue?
Assertions check that the code under test produces the expected results. When you write an equality assertion, one operand is the value from the code under test (the actual value) and the other is what you expect (the expected value).
What changed
Swaps the operands so get_artifacts_to_publish() (the actual value) comes first and the expected string 'ARTIFACTS_TO_PUBLISH' comes second. This removes the expected-first ordering that broke the file's convention.
python:S3415 - Swap these 2 operands so the actual value comes first, to match the rest of this file. • MAJOR • View issue
Location:
main/tests/utils/test_buildinfo.py:57Why is this an issue?
Assertions check that the code under test produces the expected results. When you write an equality assertion, one operand is the value from the code under test (the actual value) and the other is what you expect (the expected value).
What changed
Rewrites the assertion as
captured[0] == "No artifacts to publish", putting the captured output (actual) first and the expected message second. This aligns it with the rest of the file's assertion order.