Skip to content

Fix writing with no termination character - #221

Open
BT8298 wants to merge 1 commit into
pyvisa:mainfrom
BT8298:no-termchar
Open

Fix writing with no termination character#221
BT8298 wants to merge 1 commit into
pyvisa:mainfrom
BT8298:no-termchar

Conversation

@BT8298

@BT8298 BT8298 commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Previously, if the write termination was the empty byte, the written message was truncated to the empty byte.

I am fairly certain that serial (not GPIB, where end of input signal exists) instruments that are compliant with IEEE 488.2 must have a linefeed as a write termination (§ 7.5.2 of IEEE 488.2-1992(R2004)). Some non-compliant instruments also have write terminations, like modems using the Hayes AT command set. But instruments without a write termination character exist. Thorlabs motors using the APT protocol come to mind.

Previously, if the write termination was the empty byte, the written
message was truncated to the empty byte.
@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.31250% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.50%. Comparing base (aaddb17) to head (26ccc73).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
pyvisa_sim/devices.py 93.33% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #221      +/-   ##
==========================================
+ Coverage   86.64%   87.50%   +0.85%     
==========================================
  Files          18       19       +1     
  Lines        1041     1104      +63     
  Branches      113      124      +11     
==========================================
+ Hits          902      966      +64     
+ Misses        104      103       -1     
  Partials       35       35              
Flag Coverage Δ
unittests 87.50% <95.31%> (+0.85%) ⬆️

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.

b"+3.00000000E+00",
b"",
),
# this test fails; however, no SCPI serial devices without termination

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thoughts on this test failing? I think it's fine if this one fails, since instruments with no write termination character implement traffic control through mechanisms like fixed message length or check-summing. There are no SCPI or IEEE 488.2 serial devices without write termination to my knowledge, so this test case does not represent any real instrument.

@BT8298
BT8298 marked this pull request as ready for review June 16, 2026 17:44
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