Skip to content

Remove unused args argument from main() in test fixtures - #400

Merged
sloretz merged 1 commit into
ros2:rollingfrom
mishra-prince:fix/remove-unused-args-main
Sep 29, 2026
Merged

sloretz merged 1 commit into
ros2:rollingfrom
mishra-prince:fix/remove-unused-args-main

Conversation

@mishra-prince

Copy link
Copy Markdown
Contributor

Summary

Fixes #398.

The main() functions in two test fixtures accept an args parameter that is forwarded to rclpy.init(args=args), but nothing ever calls main() with arguments. This removes the dead parameter so the signature is def main() and calls rclpy.init() without args.

Files changed:

  • sros2/test/sros2/commands/security/verbs/fixtures/client_service_node.py
  • sros2/test/sros2/commands/security/verbs/fixtures/pub_sub_node.py

Verification

  • Confirmed no caller passes args to main() (the fixtures are launched as standalone scripts via subprocess in test_generate_policy.py and siblings, and __main__ calls main() with no arguments), so behavior is unchanged.
  • python -m py_compile passes on both files.

Note: I was unable to run the full ament/ROS integration test suite locally as it requires a built ROS 2 workspace; CI should exercise it.

What this does not touch

No other files, no unrelated refactoring.

The main() functions in the client_service_node.py and pub_sub_node.py
test fixtures accept an args parameter that is passed to rclpy.init(),
but nothing ever calls main() with arguments. Drop the unused parameter
so the signature is def main() and call rclpy.init() without args.

Fixes ros2#398

Signed-off-by: mishra-prince <88850888+mishra-prince@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 24, 2026 02:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

No unresolved review issues were identified.

Review effort: Lite
Findings: None

What changed in this PR

Removes unused args parameters from two standalone ROS 2 test fixtures.

Changes:

  • Simplifies both main() signatures.
  • Calls rclpy.init() without unused arguments.
File Description
sros2/​test/​sros2/​commands/​security/​verbs/​fixtures/​pub_sub_node.py Removes the unused initialization argument.
sros2/​test/​sros2/​commands/​security/​verbs/​fixtures/​client_service_node.py Removes the unused initialization argument.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@ahcorde

ahcorde commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Pulls: #400
Gist: https://gist.githubusercontent.com/ahcorde/cb10e71bc2576bd535a2d21118c74ef1/raw/b408fa4fa58a29e2f0548bf0c8451bf0b7c0fd05/ros2.repos
BUILD args: --packages-above-and-dependencies sros2
TEST args: --packages-above sros2
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/20560

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status - infra issue; rerun Build Status

@codecov

codecov Bot commented Sep 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.18%. Comparing base (51cedf6) to head (fc24a0b).
⚠️ Report is 1 commits behind head on rolling.

Additional details and impacted files
@@           Coverage Diff            @@
##           rolling     #400   +/-   ##
========================================
  Coverage    88.18%   88.18%           
========================================
  Files           18       18           
  Lines          601      601           
  Branches        53       53           
========================================
  Hits           530      530           
  Misses          52       52           
  Partials        19       19           
Flag Coverage Δ
unittests 88.18% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 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.

@sloretz
sloretz merged commit 6d1ea43 into ros2:rolling Sep 29, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Delete unused args argument from main() in Python files

4 participants