-
-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
replace the call to serial.Serial with serial.serial_for_url #386
Merged
Merged
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d17258c
replace the call to Serial.serial with serial.serial_for_url, in order
LongnoseRob 10f052e
documentation update
LongnoseRob 6c3e83d
initial test-addition
LongnoseRob 5e0e5d6
fix the testsuite
LongnoseRob 570bf02
add conditional skip if PySerial is not found
LongnoseRob e175de1
add pyserial as package avialable for the test environment
LongnoseRob f2f92c0
change extra package installation
LongnoseRob 43f04c9
Update CHNAGES file
LongnoseRob cdd8d32
implement code-review changes
LongnoseRob File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
"""Test creating a resource manager using PyVISA-Py as a backend. | ||
|
||
|
||
:copyright: 2014-2023 by PyVISA-py Authors, see AUTHORS for more details. | ||
:license: MIT, see LICENSE for more details. | ||
|
||
""" | ||
import pytest | ||
from pyvisa import ResourceManager | ||
from pyvisa.testsuite import BaseTestCase | ||
|
||
|
||
class TestSerial(BaseTestCase): | ||
"""Test generic property of PyVisaLibrary.""" | ||
|
||
serial = pytest.importorskip("serial", reason="PySerial not installed") | ||
|
||
def test_serial(self): | ||
"""Test loop://""" | ||
msg = b"Test01234567890" | ||
|
||
available = ["loop://"] | ||
expected = [] | ||
exp_missing = [] | ||
missing = {} | ||
|
||
rm = ResourceManager("@py") | ||
try: | ||
dut = rm.open_resource("ASRLloop://::INSTR") | ||
print("opened") | ||
dut.timeout = 3000 | ||
dut.read_termination = "\r\n" | ||
dut.write_termination = "\r\n" | ||
dut.write(str(msg)) | ||
ret_val = dut.read() | ||
if str(msg) == ret_val: | ||
expected = ["loop://"] | ||
|
||
except Exception: | ||
exp_missing = ["loop://"] | ||
|
||
assert sorted(available) == sorted(expected) | ||
assert sorted(missing) == sorted(exp_missing) |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could do
pip install -e .[serial]
instead with a comment explining why we install this extra.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you would prefer it that way, I will change it.