From 1c5bdce775123f6989c57bb75394c0ae04f18a4a Mon Sep 17 00:00:00 2001 From: Daniele Forsi IU5HKX Date: Sun, 25 May 2025 16:31:30 +0200 Subject: [PATCH] Split the tests and remove simpler tests --- bindings/python/test_amp.py | 21 +++++++++------------ bindings/python/test_rot.py | 23 +++++++++-------------- 2 files changed, 18 insertions(+), 26 deletions(-) diff --git a/bindings/python/test_amp.py b/bindings/python/test_amp.py index 1de2870bf..1af6a287a 100755 --- a/bindings/python/test_amp.py +++ b/bindings/python/test_amp.py @@ -14,20 +14,11 @@ AMP_MODEL = Hamlib.AMP_MODEL_DUMMY class TestClass: """Container class for tests""" - def test_open_close(self): - """Smoke test""" - amp = Hamlib.Amp(AMP_MODEL) - assert amp is not None - assert amp.open() is None - assert amp.close() is None - - - def test_all_methods(self): - """Just call all the methods""" + def test_without_open(self): + """Call all the methods that do not depend on open()""" amp = Hamlib.Amp(AMP_MODEL) assert amp is not None - # the tests that do not depend on open() assert amp.set_conf("", "") is None assert amp.get_conf("") == "" assert amp.get_conf(0) == "" @@ -36,9 +27,15 @@ class TestClass: assert amp.set_conf("mcfg", "foo") is None conf = amp.get_conf("mcfg") assert conf == "" # FIXME: should return "foo" + assert amp.token_lookup("") is None - # the tests that depend on open() + + def test_with_open(self): + """Call all the methods that depend on open()""" + amp = Hamlib.Amp(AMP_MODEL) + assert amp is not None + assert amp.state.comm_state == 0 assert amp.open() is None assert amp.state.comm_state == 1 diff --git a/bindings/python/test_rot.py b/bindings/python/test_rot.py index 1cbafcca8..2d67f7d9b 100755 --- a/bindings/python/test_rot.py +++ b/bindings/python/test_rot.py @@ -14,22 +14,11 @@ ROT_MODEL = Hamlib.ROT_MODEL_DUMMY class TestClass: """Container class for tests""" - def test_open_close(self): - """Smoke test""" - rot = Hamlib.Rot(ROT_MODEL) - assert rot is not None - assert rot.open() is None - assert rot.set_position(0.0, 0.0) is None - assert rot.get_position() is not None - assert rot.close() is None - - - def test_all_methods(self): - """Just call all the methods""" + def test_without_open(self): + """Call all the methods that do not depend on open()""" rot = Hamlib.Rot(ROT_MODEL) assert rot is not None - # the tests that do not depend on open() assert rot.set_conf("", "") is None assert rot.get_conf("") == "" assert rot.get_conf(0) == "" @@ -38,9 +27,15 @@ class TestClass: assert rot.set_conf("mcfg", "foo") is None conf = rot.get_conf("mcfg") assert conf == "foo" + assert rot.token_lookup("") is None - # the tests that depend on open() + + def test_with_open(self): + """Call all the methods that depend on open()""" + rot = Hamlib.Rot(ROT_MODEL) + assert rot is not None + assert rot.state.comm_state == 0 assert rot.open() is None assert rot.state.comm_state == 1