-
-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
replace the call to serial.Serial with serial.serial_for_url (#386)
* replace the call to Serial.serial with serial.serial_for_url, in order to support loop:// and other url-types supported in pyserial (>3.0) * documentation update * initial test-addition * fix the testsuite * add conditional skip if PySerial is not found * add pyserial as package avialable for the test environment * change extra package installation * Update CHNAGES file * implement code-review changes
- Loading branch information
1 parent
dc58253
commit 8016ec0
Showing
5 changed files
with
59 additions
and
6 deletions.
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
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) |