diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3a26fef..0d8c7ef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,8 +5,8 @@ jobs: test: strategy: matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - python-ver: [3.7, 3.8, 3.9, '3.10', 3.11, 3.12] + os: [ubuntu-latest, windows-latest] + python-ver: [3.8, 3.9, '3.10', 3.11, 3.12] runs-on: ${{ matrix.os }} diff --git a/sksurgerynditracker/nditracker.py b/sksurgerynditracker/nditracker.py index f3655d9..176aa06 100644 --- a/sksurgerynditracker/nditracker.py +++ b/sksurgerynditracker/nditracker.py @@ -61,8 +61,7 @@ def _get_serial_port_name(configuration): serial_ports = list_ports.comports() result = None name = None - if ports_to_probe > len(serial_ports): - ports_to_probe = len(serial_ports) + ports_to_probe = min(ports_to_probe, len(serial_ports)) if serial_port is None: for port_no in range(ports_to_probe): @@ -88,8 +87,9 @@ def _get_serial_port_name(configuration): print("Probing port: ", serial_port, " got name: ", name, " Result: ", result, file=fileout) else: - raise IOError(f'Could not connect to serial port {serial_port} ' - f'as there are only {len(serial_ports)} ports available.' + raise IOError(f'Could not connect to serial port' + f'{serial_port} as there are ' + f'only {len(serial_ports)} ports available.' + serial_connection_errmsg) if isinstance(serial_port, str): @@ -97,9 +97,10 @@ def _get_serial_port_name(configuration): result = ndicapy.ndiProbe(name) print("Probing port: ", name, " Result: ", result, file=fileout) - + if result != ndicapy.NDI_OKAY: - raise IOError(f'Could not connect to an NDI device on the chosen port, {serial_port}.' + raise IOError(f'Could not connect to an NDI device on ' + f'the chosen port, {serial_port}.' + serial_connection_errmsg) return name diff --git a/tests/pylintrc b/tests/pylintrc index cc5da78..d350f78 100644 --- a/tests/pylintrc +++ b/tests/pylintrc @@ -13,7 +13,7 @@ ignore=CVS # Add files or directories matching the regex patterns to the blacklist. The # regex matches against base names, not paths. -ignore-patterns= +ignore-patterns=_version.py # Pickle collected data for later comparisons. persistent=yes diff --git a/tests/test_listports.py b/tests/test_listports.py index 46c8786..4f6e19f 100644 --- a/tests/test_listports.py +++ b/tests/test_listports.py @@ -21,8 +21,7 @@ def test_list_ports(): ndi_port_names.append(ndiDeviceName(port_number)) try: windows_port_number = int(serial_port.device.replace('COM', '')) - if windows_port_number > max_com_port: - max_com_port = windows_port_number + max_com_port = max(max_com_port, windows_port_number) except ValueError: # we're probably not on windows, so don't care pass diff --git a/tox.ini b/tox.ini index d425668..98d2857 100644 --- a/tox.ini +++ b/tox.ini @@ -1,12 +1,12 @@ # content of: tox.ini , put in same dir as setup.py [tox] -envlist = py37,lint +envlist = py310,lint skipsdist = True requires = setuptools >= 47.1 [travis] python = - 3.7: py37, docs, lint + 3.10: py310, docs, lint [testenv] deps=-rrequirements-dev.txt @@ -17,22 +17,22 @@ commands = coverage erase coverage report -m [testenv:lint] -basepython=python3.7 +basepython=python3.10 deps=pylint {[testenv]deps} commands=pylint --rcfile=tests/pylintrc sksurgerynditracker tests [testenv:docs] -basepython=python3.7 +basepython=python3.10 changedir = docs commands = sphinx-build -M html . build [testenv:installer] -basepython=python3.7 +basepython=python3.10 commands=python -c "print('Installer not needed for this project.')" [testenv:pip3] -basepython=python3.7 +basepython=python3.10 changedir=pip_test skip_install=True commands = pip install {posargs}