Skip to content

Improve test coverage for src/call.rs#5951

Draft
leftygbalogh wants to merge 3 commits intoPyO3:mainfrom
leftygbalogh:lefty/tests-call-coverage
Draft

Improve test coverage for src/call.rs#5951
leftygbalogh wants to merge 3 commits intoPyO3:mainfrom
leftygbalogh:lefty/tests-call-coverage

Conversation

@leftygbalogh
Copy link
Copy Markdown

Closes #2453 (partially). Fixes check_call! macro bug and adds tests for uncovered paths.

lefty added 3 commits April 5, 2026 18:28
The check_call! macros in test_call and test_call_positional ignored
their \ parameter, always calling with the outer args.clone()
(Bound<'py, PyTuple>). All five invocations therefore tested only the
Bound path, leaving &Bound, Py, &Py, and Borrowed impls uncovered.

Fix both macros to use \ and \ so each invocation exercises
the intended PyCallArgs impl.

Add three new tests:
- test_call_unit_args: covers ()::call and ()::call_positional impls
- test_call_method_positional_default: covers the default
  call_method_positional trait method (happy path + AttributeError path)
- test_call_error_paths: covers the error return paths in Borrowed::call
  and Borrowed::call_positional (TypeError from PyObject_Call)
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.

Improving test coverage

1 participant