Skip to content

Commit

Permalink
Merge pull request #58 from SciKit-Surgery/31-low-code-coverage
Browse files Browse the repository at this point in the history
31 - low code coverage
  • Loading branch information
thompson318 committed Nov 9, 2022
2 parents 99fc17d + 9397fd8 commit 888af08
Show file tree
Hide file tree
Showing 6 changed files with 344 additions and 27 deletions.
12 changes: 4 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@ jobs:
test:
strategy:
matrix:
os: [ubuntu-18.04, macos-latest, windows-latest]
python-ver: [3.7, 3.8]

include:
- os: ubuntu-18.04
python-ver: 3.9
os: [ubuntu-20.04, ubuntu-22.04, macos-latest, windows-latest]
python-ver: [3.7, 3.8, 3.9]

runs-on: ${{ matrix.os }}

Expand Down Expand Up @@ -41,15 +37,15 @@ jobs:
coveralls
deploy:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
needs: test
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@master
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.6
python-version: 3.7

- name: Install dependencies
run: python -m pip install wheel twine setuptools
Expand Down
16 changes: 10 additions & 6 deletions tests/test_listports.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
""" Lets see what com ports pyserial reports on our test runners"""

from serial.tools import list_ports #pylint: disable=import-error
import sys
from serial.tools import list_ports # pylint: disable=import-error
from ndicapy import ndiDeviceName


def test_list_ports():
"""
Check that ndicapy.ndiDeviceName gets all the comports found
by pyserial
"""
#list ports
print([comport.device for comport in list_ports.comports()])
print("List of available ports: ",
[comport.device for comport in list_ports.comports()])

serial_ports = list_ports.comports()

Expand All @@ -22,7 +24,7 @@ def test_list_ports():
if windows_port_number > max_com_port:
max_com_port = windows_port_number
except ValueError:
#we're probably not on windows, so don't care
# we're probably not on windows, so don't care
pass

while len(ndi_port_names) < max_com_port:
Expand All @@ -31,5 +33,7 @@ def test_list_ports():

for serial_port in serial_ports:
pyserial_port_name = serial_port.device
print("Checking port:", pyserial_port_name, ndi_port_names)
assert pyserial_port_name in ndi_port_names
print("Checking port:", pyserial_port_name,
"in ndi_port_names: ", ndi_port_names)
if 'linux' not in sys.platform:
assert pyserial_port_name in ndi_port_names
27 changes: 27 additions & 0 deletions tests/test_sksurgerynditracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,33 @@ def test_configure():
tracker = NDITracker(no_port)
del tracker

with pytest.raises(KeyError):
no_tracker_type = {
"tracker_type": "vega",
"ip address": "tracker",
"romfiles": "[rom]"
}
tracker = NDITracker(no_tracker_type)
del tracker

with pytest.raises(KeyError):
no_rom_files_vega = {
"tracker type": "vega",
"ip address": "tracker",
}
tracker = NDITracker(no_rom_files_vega)
del tracker

with pytest.raises(FileNotFoundError):
no_rom_files_in_paths_polaris = {
"tracker type": "polaris",
"romfiles" : [
"data/something_else_rom",
"data/8700339_rom"]
}
tracker = NDITracker(no_rom_files_in_paths_polaris)
del tracker

with pytest.raises(IOError) or pytest.raises(OSError):
aurora = {"tracker type": "aurora"}
tracker = NDITracker(aurora)
Expand Down
Loading

0 comments on commit 888af08

Please sign in to comment.