Add s7 unified client/server tests, fix mypy issues#691
Merged
Conversation
28b271b to
6a9842c
Compare
32 tests for s7.Client and s7.Server using the built-in emulators: - Legacy: connect, db_read, db_write, db_read_multi, list_datablocks, context manager, delegated methods, diagnostic buffer - S7CommPlus: connect, db_read, db_write, db_read_multi, explore, list_datablocks, browse, browse-to-SymbolTable, auto-detection - Server: context manager, register_db/raw_db, get_db, properties - Guard tests: browse/explore/subscription require S7CommPlus Bug fixes: - s7/client.py: legacy connection optional when S7CommPlus explicit - s7/_s7commplus_client.py: EXPLORE parser handles WSTRING (0x15), UDINT (0x04) datatypes, skips return code VLQ, tracks nesting depth to avoid child objects overwriting parent DB name/number - s7/_s7commplus_server.py: EXPLORE response uses standard S7CommPlus IDs (Ids.OBJECT_VARIABLE_TYPE_NAME, Ids.BLOCK_BLOCK_NUMBER) with proper flags+datatype encoding Coverage: s7/client.py 21%→88%, s7/_s7commplus_client.py 40%→67%, total 78%→81%. mypy clean (0 errors across 79 files). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
6a9842c to
ea259b9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
s7package (unified client/server) had zero direct tests — everything was tested throughsnap7. This adds 24 tests using the built-in server emulator.Coverage improvements:
s7/client.py: 21% → 77%s7/server.py: 43% → 84%Tests added:
Also fixes unused
type: ignorecomments and missing import intest_logging.py.Test plan
🤖 Generated with Claude Code