kopia lustrzana https://github.com/Hamlib/Hamlib
Handle --rot-file and --serial_speed in bindings tests
This allow to run the tests for a specific model, eg. PYTHONPATH=bindings/:bindings/.libs bindings/python/test_rot.py --model 2pull/1902/head
rodzic
911169d794
commit
a9afa8d4d9
|
@ -43,6 +43,10 @@ def amp_file(request):
|
||||||
def rig_file(request):
|
def rig_file(request):
|
||||||
return request.config.getoption("--rig-file")
|
return request.config.getoption("--rig-file")
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def rot_file(request):
|
||||||
|
return request.config.getoption("--rot-file")
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def serial_speed(request):
|
def serial_speed(request):
|
||||||
return request.config.getoption("--serial-speed")
|
return request.config.getoption("--serial-speed")
|
||||||
|
|
|
@ -5,6 +5,7 @@ Running this script directly will use the installed bindings.
|
||||||
For an in-tree run use "make check", or set PYTHONPATH to point to
|
For an in-tree run use "make check", or set PYTHONPATH to point to
|
||||||
the directories containing Hamlib.py and _Hamlib.so.
|
the directories containing Hamlib.py and _Hamlib.so.
|
||||||
"""
|
"""
|
||||||
|
import pytest
|
||||||
from pytest import raises
|
from pytest import raises
|
||||||
|
|
||||||
import Hamlib
|
import Hamlib
|
||||||
|
@ -49,12 +50,18 @@ class TestClass:
|
||||||
assert rot.token_lookup("") is None
|
assert rot.token_lookup("") is None
|
||||||
|
|
||||||
|
|
||||||
def test_with_open(self, model):
|
@pytest.mark.skipif('config.getoption("model") != Hamlib.ROT_MODEL_DUMMY')
|
||||||
|
def test_with_open(self, model, rot_file, serial_speed):
|
||||||
"""Call all the methods that depend on open()"""
|
"""Call all the methods that depend on open()"""
|
||||||
rot = Hamlib.Rot(model)
|
rot = Hamlib.Rot(model)
|
||||||
assert rot is not None
|
assert rot is not None
|
||||||
|
|
||||||
assert rot.state.comm_state == 0
|
assert rot.state.comm_state == 0
|
||||||
|
# first try a known string because rot_file is None during "make check"
|
||||||
|
assert rot.set_conf("rot_pathname", "foo") is None
|
||||||
|
assert rot.get_conf("rot_pathname") == "foo"
|
||||||
|
assert rot.set_conf("rot_pathname", rot_file) is None
|
||||||
|
assert rot.set_conf("serial_speed", str(serial_speed)) is None
|
||||||
assert rot.open() is None
|
assert rot.open() is None
|
||||||
assert rot.state.comm_state == 1
|
assert rot.state.comm_state == 1
|
||||||
info = rot.get_info()
|
info = rot.get_info()
|
||||||
|
@ -108,6 +115,7 @@ class TestClass:
|
||||||
assert info is None
|
assert info is None
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif('config.getoption("model") != Hamlib.ROT_MODEL_DUMMY')
|
||||||
def test_object_creation(self, model):
|
def test_object_creation(self, model):
|
||||||
"""Create all objects available"""
|
"""Create all objects available"""
|
||||||
rot = Hamlib.Rig(model)
|
rot = Hamlib.Rig(model)
|
||||||
|
|
Ładowanie…
Reference in New Issue