diff --git a/bindings/python/conftest.py b/bindings/python/conftest.py index 89ba590d9..4f5510778 100644 --- a/bindings/python/conftest.py +++ b/bindings/python/conftest.py @@ -5,6 +5,11 @@ import sys def pytest_addoption(parser): # using long options only because short options conflict with pytest's + if sys.argv[1].endswith("amp.py"): + parser.addoption('--model', type=int, default=1, + metavar='ID', help='select amplifier model number') + parser.addoption('--amp-file', default=None, + metavar='DEVICE', help='set device of the amplifier to operate on') if sys.argv[1].endswith("rig.py"): parser.addoption('--model', type=int, default=1, metavar='ID', help='select radio model number') diff --git a/bindings/python/test_amp.py b/bindings/python/test_amp.py index 9d6a1d738..1a0b5eac3 100755 --- a/bindings/python/test_amp.py +++ b/bindings/python/test_amp.py @@ -9,14 +9,12 @@ import Hamlib Hamlib.rig_set_debug(Hamlib.RIG_DEBUG_NONE) -AMP_MODEL = Hamlib.AMP_MODEL_DUMMY - class TestClass: """Container class for tests""" - def test_without_open(self): + def test_without_open(self, model): """Call all the methods that do not depend on open()""" - amp = Hamlib.Amp(AMP_MODEL) + amp = Hamlib.Amp(model) assert amp is not None assert amp.do_exception == 0 assert amp.error_status == Hamlib.RIG_OK @@ -38,9 +36,9 @@ class TestClass: assert amp.token_lookup("") is None - def test_with_open(self): + def test_with_open(self, model): """Call all the methods that depend on open()""" - amp = Hamlib.Amp(AMP_MODEL) + amp = Hamlib.Amp(model) assert amp is not None assert amp.state.comm_state == 0 @@ -70,9 +68,9 @@ class TestClass: assert info is None - def test_object_creation(self): + def test_object_creation(self, model): """Create all objects available""" - amp = Hamlib.Rig(AMP_MODEL) + amp = Hamlib.Rig(model) assert amp is not None assert isinstance(amp.caps, Hamlib.rig_caps)