Skip to content

test: call _attach_piggyback_ack on a real thread instance - #293

Merged
hemna merged 1 commit into
masterfrom
fix/issue-38-rx-piggyback-test-instance
Sep 18, 2026
Merged

hemna merged 1 commit into
masterfrom
fix/issue-38-rx-piggyback-test-instance

Conversation

@hemna

@hemna hemna commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

The piggyback-ack unit tests (tests/threads/test_rx_piggyback.py) invoked the
instance method with None as self:

attached = rx.APRSDPluginProcessPacketThread._attach_piggyback_ack(None, response, '12')

This only works because _attach_piggyback_ack happens not to use self — a
fragile pattern flagged as a MINOR finding in docs/code-review-2026-09-18.md.

Change

Construct a real APRSDPluginProcessPacketThread in setUp (the APRSDClient
is mocked exactly as before) and call the method through the instance:

self.process_thread = rx.APRSDPluginProcessPacketThread(queue.Queue())
attached = self.process_thread._attach_piggyback_ack(response, '12')

Pure test change — no production code touched.

Tests

pytest tests/threads/test_rx_piggyback.py: 3 passed. Full suite: 749 passed.
ruff check aprsd/ tests/: clean.

The piggyback ack unit tests invoked the instance method with None as
self (APRSDPluginProcessPacketThread._attach_piggyback_ack(None, ...)),
which works only by luck because the method happens not to use self.

Construct a real APRSDPluginProcessPacketThread (with the APRSDClient
mocked as before) and call the method through it.

Addresses MINOR finding in docs/code-review-2026-09-18.md.
@hemna
hemna merged commit 39be5d4 into master Sep 18, 2026
8 checks passed
@hemna
hemna deleted the fix/issue-38-rx-piggyback-test-instance branch September 18, 2026 18:18
hemna added a commit that referenced this pull request Sep 19, 2026
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.

1 participant