Skip to content

Commit

Permalink
Merge branch 'master' into gpib-commands
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthieuDartiailh authored Oct 8, 2020
2 parents 087ee5f + 729abb1 commit f41bfae
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
5 changes: 3 additions & 2 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
PyVISA-py Changelog
===================

0.5.1 (unreleased)
0.5.1 (30-09-2020)
------------------

- fix GPIB commands used in control_ren implementation PR #276
- list serial resources under Windows without the COM prefix #269
- fix writing to serial resources PR #277
- fix return value of USB close method PR #265
- fix pyvisa version contraint PR #268
- fix pyvisa version constraint PR #268

0.5.0 (16-09-2020)
------------------
Expand Down
12 changes: 10 additions & 2 deletions pyvisa_py/serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
:license: MIT, see LICENSE for more details.
"""
import sys
from typing import Any, List, Optional, Tuple

from pyvisa import attributes, constants, logger, rname
Expand All @@ -30,6 +31,8 @@
)
raise

IS_WIN = sys.platform == "win32"


def iter_bytes(data: bytes, mask: Optional[int] = None, send_end: bool = False):
if send_end and mask is None:
Expand Down Expand Up @@ -66,7 +69,10 @@ class SerialSession(Session):

@staticmethod
def list_resources() -> List[str]:
return ["ASRL%s::INSTR" % port[0] for port in comports()]
return [
"ASRL%s::INSTR" % (port[0][3:] if IS_WIN else port[0])
for port in comports()
]

@classmethod
def get_low_level_info(cls) -> str:
Expand All @@ -81,7 +87,9 @@ def after_parsing(self) -> None:
cls = serial.Serial

self.interface = cls(
port=self.parsed.board, timeout=self.timeout, write_timeout=self.timeout
port=("COM" if IS_WIN else "") + self.parsed.board,
timeout=self.timeout,
write_timeout=self.timeout,
)

for name in (
Expand Down
5 changes: 5 additions & 0 deletions pyvisa_py/testsuite/test_highlevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
:license: MIT, see LICENSE for more details.
"""
from pyvisa.highlevel import list_backends
from pyvisa.testsuite import BaseTestCase

from pyvisa_py import highlevel
Expand All @@ -14,6 +15,10 @@
class TestPyVisaLibrary(BaseTestCase):
"""Test generic property of PyVisaLibrary."""

def test_list_backends(self):
"""Test listing backends."""
assert "py" in list_backends()

def test_debug_info(self):
"""Test generating debug infos for PyVISA-py."""
infos = highlevel.PyVisaLibrary.get_debug_info()
Expand Down

0 comments on commit f41bfae

Please sign in to comment.