Skip to content

Conversation

@harvey0100
Copy link
Contributor

@harvey0100 harvey0100 commented Dec 17, 2025

Mock system_output instead of system since can_sudo() without cmd calls system_output.

Assisted-By: Claude 4.5 Sonnet

Summary by CodeRabbit

  • Tests
    • Updated unit test to simulate a command execution raising an OSError and verify the sudo-check behavior returns false, enhancing error-handling coverage for process utilities.

✏️ Tip: You can customize this high-level summary in your review settings.

@harvey0100 harvey0100 self-assigned this Dec 17, 2025
@coderabbitai
Copy link

coderabbitai bot commented Dec 17, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

The pull request updates a unit test in selftests/unit/utils/process.py. In test_can_sudo_oserror the mocked dependency is switched from system to getoutput; the test function parameter and mock variable name are updated, and the OSError side effect is applied to getoutput. The assertion checks that can_sudo() returns False when getoutput raises OSError.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Single test file changed with a localized, consistent mock substitution
  • No production code or API signatures modified
  • Review focus:
    • Verify the mock target (getoutput) matches the implementation point used by can_sudo()
    • Confirm the test name and assertions remain semantically correct

Pre-merge checks

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Process CI Selftests Failure' is vague and does not clearly convey the specific change made in the pull request, which is to fix a mock dependency in a unit test. Use a more descriptive title that reflects the actual change, such as 'Fix process.py test by mocking getoutput instead of system' to clearly communicate the modification to reviewers.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7cbc8ae and 40249d0.

📒 Files selected for processing (1)
  • selftests/unit/utils/process.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • selftests/unit/utils/process.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (35)
  • GitHub Check: rpm-build:centos-stream-9-x86_64
  • GitHub Check: rpm-build:fedora-41-ppc64le
  • GitHub Check: rpm-build:fedora-42-x86_64
  • GitHub Check: rpm-build:fedora-rawhide-x86_64
  • GitHub Check: rpm-build:epel-9-x86_64
  • GitHub Check: rpm-build:fedora-43-x86_64
  • GitHub Check: rpm-build:fedora-41-aarch64
  • GitHub Check: rpm-build:fedora-41-s390x
  • GitHub Check: rpm-build:fedora-rawhide-x86_64
  • GitHub Check: rpm-build:fedora-41-aarch64
  • GitHub Check: rpm-build:fedora-42-x86_64
  • GitHub Check: rpm-build:epel-9-x86_64
  • GitHub Check: rpm-build:fedora-41-s390x
  • GitHub Check: rpm-build:fedora-43-x86_64
  • GitHub Check: rpm-build:centos-stream-9-x86_64
  • GitHub Check: rpm-build:fedora-41-ppc64le
  • GitHub Check: rpm-build:fedora-43-x86_64
  • GitHub Check: rpm-build:centos-stream-9-x86_64
  • GitHub Check: rpm-build:epel-9-x86_64
  • GitHub Check: rpm-build:fedora-41-s390x
  • GitHub Check: rpm-build:fedora-42-x86_64
  • GitHub Check: rpm-build:fedora-41-ppc64le
  • GitHub Check: rpm-build:fedora-rawhide-x86_64
  • GitHub Check: rpm-build:fedora-41-aarch64
  • GitHub Check: Version task ubi:9.2
  • GitHub Check: Build Package (wheel/tarball) for Python 3.13
  • GitHub Check: Windows with Python 3.10
  • GitHub Check: Windows with Python 3.12
  • GitHub Check: macOS with Python 3.11
  • GitHub Check: Windows with Python 3.13
  • GitHub Check: Static checks
  • GitHub Check: Version task fedora:40
  • GitHub Check: Windows with Python 3.9
  • GitHub Check: Analyze (python)
  • GitHub Check: Code Coverage (3.11)

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link

Summary of Changes

Hello @harvey0100, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a CI selftest failure by refining a unit test within avocado.utils.process. The core change involves updating a mock target to accurately reflect the internal function calls of can_sudo(), specifically when it operates without a command. This ensures the test correctly validates error handling paths, enhancing the robustness of the process utility.

Highlights

  • Corrected Mocking Target: The test_can_sudo_oserror unit test now correctly mocks avocado.utils.process.system_output instead of avocado.utils.process.system.
  • Improved Test Accuracy: This change ensures that the OSError handling within the can_sudo() function (when called without a command) is properly tested, as can_sudo() internally calls system_output() in this scenario.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@mr-avocado mr-avocado bot moved this to Review Requested in Default project Dec 17, 2025
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request aims to fix a failing CI selftest by correcting a mock in test_can_sudo_oserror. While it correctly identifies that system should not be mocked, it replaces it with a mock for system_output, which is also incorrect. The can_sudo() function, when called without arguments, uses getoutput(). I've provided a critical comment with a suggestion to mock getoutput instead to ensure the test correctly verifies the intended behavior.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fb9f609 and 7cbc8ae.

📒 Files selected for processing (1)
  • selftests/unit/utils/process.py (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (48)
  • GitHub Check: rpm-build:fedora-rawhide-x86_64
  • GitHub Check: rpm-build:epel-9-x86_64
  • GitHub Check: rpm-build:fedora-41-ppc64le
  • GitHub Check: rpm-build:centos-stream-9-x86_64
  • GitHub Check: rpm-build:fedora-41-aarch64
  • GitHub Check: rpm-build:fedora-42-x86_64
  • GitHub Check: rpm-build:fedora-43-x86_64
  • GitHub Check: rpm-build:fedora-41-aarch64
  • GitHub Check: rpm-build:fedora-43-x86_64
  • GitHub Check: rpm-build:epel-9-x86_64
  • GitHub Check: rpm-build:centos-stream-9-x86_64
  • GitHub Check: rpm-build:fedora-41-s390x
  • GitHub Check: rpm-build:fedora-rawhide-x86_64
  • GitHub Check: rpm-build:fedora-41-ppc64le
  • GitHub Check: rpm-build:fedora-42-x86_64
  • GitHub Check: rpm-build:fedora-43-x86_64
  • GitHub Check: rpm-build:fedora-rawhide-x86_64
  • GitHub Check: rpm-build:fedora-42-x86_64
  • GitHub Check: rpm-build:centos-stream-9-x86_64
  • GitHub Check: rpm-build:fedora-41-aarch64
  • GitHub Check: rpm-build:fedora-41-ppc64le
  • GitHub Check: rpm-build:epel-9-x86_64
  • GitHub Check: rpm-build:fedora-41-s390x
  • GitHub Check: rpm-build:fedora-41-ppc64le
  • GitHub Check: rpm-build:fedora-43-x86_64
  • GitHub Check: rpm-build:centos-stream-9-x86_64
  • GitHub Check: rpm-build:fedora-41-s390x
  • GitHub Check: rpm-build:fedora-41-aarch64
  • GitHub Check: rpm-build:fedora-rawhide-x86_64
  • GitHub Check: rpm-build:fedora-42-x86_64
  • GitHub Check: rpm-build:epel-9-x86_64
  • GitHub Check: Egg task fedora:40
  • GitHub Check: Podman spawner with 3rd party runner plugin
  • GitHub Check: Egg task debian:11.0
  • GitHub Check: Version task ubuntu:22.04
  • GitHub Check: Fedora selftests
  • GitHub Check: Version task debian:12.4
  • GitHub Check: Version task ubuntu:24.04
  • GitHub Check: Egg task ubuntu:22.04
  • GitHub Check: Version task ubi:8.8
  • GitHub Check: Version task fedora:41
  • GitHub Check: Build Package (wheel/tarball) for Python 3.13
  • GitHub Check: Windows with Python 3.13
  • GitHub Check: Smokecheck on Linux with Python 3.13
  • GitHub Check: Windows with Python 3.12
  • GitHub Check: macOS with Python 3.11
  • GitHub Check: Static checks
  • GitHub Check: Code Coverage (3.11)

Mock system_output instead of system since can_sudo() without
cmd calls system_output.

Assisted-By: Claude 4.5 Sonnet
Signed-off-by: Harvey Lynden <hlynden@redhat.com>
@codecov
Copy link

codecov bot commented Dec 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.58%. Comparing base (4221794) to head (40249d0).
⚠️ Report is 6 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6258   +/-   ##
=======================================
  Coverage   73.57%   73.58%           
=======================================
  Files         206      206           
  Lines       22497    22497           
=======================================
+ Hits        16552    16554    +2     
+ Misses       5945     5943    -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@richtja richtja merged commit 111ca38 into avocado-framework:master Dec 18, 2025
62 of 65 checks passed
@github-project-automation github-project-automation bot moved this from Review Requested to Done 113 in Default project Dec 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done 113

Development

Successfully merging this pull request may close these issues.

2 participants