Skip to content

Commit 3c15573

Browse files
committed
Handle --rot-file and --serial_speed in bindings tests
1 parent 5be35b3 commit 3c15573

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

bindings/python/conftest.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ def amp_file(request):
4343
def rig_file(request):
4444
return request.config.getoption("--rig-file")
4545

46+
@pytest.fixture
47+
def rot_file(request):
48+
return request.config.getoption("--rot-file")
49+
4650
@pytest.fixture
4751
def serial_speed(request):
4852
return request.config.getoption("--serial-speed")

bindings/python/test_rot.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
For an in-tree run use "make check", or set PYTHONPATH to point to
66
the directories containing Hamlib.py and _Hamlib.so.
77
"""
8+
import pytest
89
from pytest import raises
910

1011
import Hamlib
@@ -49,12 +50,18 @@ def test_without_open(self, model):
4950
assert rot.token_lookup("") is None
5051

5152

52-
def test_with_open(self, model):
53+
@pytest.mark.skipif('config.getoption("model") != Hamlib.ROT_MODEL_DUMMY')
54+
def test_with_open(self, model, rot_file, serial_speed):
5355
"""Call all the methods that depend on open()"""
5456
rot = Hamlib.Rot(model)
5557
assert rot is not None
5658

5759
assert rot.state.comm_state == 0
60+
# first try a known string because rot_file is None during "make check"
61+
assert rot.set_conf("rot_pathname", "foo") is None
62+
assert rot.get_conf("rot_pathname") == "foo"
63+
assert rot.set_conf("rot_pathname", rot_file) is None
64+
assert rot.set_conf("serial_speed", str(serial_speed)) is None
5865
assert rot.open() is None
5966
assert rot.state.comm_state == 1
6067
info = rot.get_info()
@@ -108,6 +115,7 @@ def test_with_open(self, model):
108115
assert info is None
109116

110117

118+
@pytest.mark.skipif('config.getoption("model") != Hamlib.ROT_MODEL_DUMMY')
111119
def test_object_creation(self, model):
112120
"""Create all objects available"""
113121
rot = Hamlib.Rig(model)

0 commit comments

Comments
 (0)