Skip to content

Cover the sync-via-async client paths (#3088 follow-up) - #3090

Merged
janiversen merged 1 commit into
pymodbus-dev:devfrom
sankalpsthakur:fix/3088-sync-client-coverage
Nov 17, 2026
Merged

janiversen merged 1 commit into
pymodbus-dev:devfrom
sankalpsthakur:fix/3088-sync-client-coverage

Conversation

@sankalpsthakur

Copy link
Copy Markdown
Contributor

Follow-up to #3088, which merged with 2 gaps in coverage. Sorry for missing the CI error

./check_ci.sh on dev showed:

  • pymodbus/client/base.py line 278: the raise TypeError in _create_async_client(), for a client without an async counterpart
  • branch 290->296 in _close_async(): a loop thread without an async client. That is the state _connect_async() leaves when _create_async_client() raises

test_no_async_counterpart in test/client/test_client_sync_loop.py covers both. It sets _async_client_factory to None, checks that connect() raises TypeError, and that close() then stops the private loop (no pymodbus-sync-client thread left). The temporary # pragma: no cover lines from a0af0f0 are removed

Validation

  • ./check_ci.sh passes locally (codespell, ruff, pylint, zuban, pytest -x --cov --numprocesses auto): 2024 passed, 7 skipped, total coverage 100.00%
  • Without the new test, the same run fails with 99.98% (base.py 278, 290->296)

AI disclosure: written with an AI coding agent and tested as described above

Test a sync tcp client without an async counterpart: connect() raises
TypeError and close() still stops the private loop. This covers the
raise in _create_async_client() and the branch in _close_async() with a
loop thread but no async client, so the temporary pragmas from
a0af0f0 are removed.

@janiversen janiversen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We are just humans, thanks for solving it rapidly.

@janiversen
janiversen merged commit 19808cc into pymodbus-dev:dev Nov 17, 2026
16 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.

2 participants