kopia lustrzana https://github.com/Hamlib/Hamlib
Merge GitHub PR #1803
commit
b2934c70a2
|
@ -18,6 +18,7 @@ jobs:
|
|||
--enable-parallel=no
|
||||
--enable-pytest=no
|
||||
--enable-shared=yes
|
||||
--enable-silent-rules
|
||||
--enable-static=yes
|
||||
--enable-usrp=no
|
||||
--enable-winradio=no
|
||||
|
@ -35,6 +36,7 @@ jobs:
|
|||
--enable-parallel=yes
|
||||
--enable-pytest=yes
|
||||
--enable-shared=yes
|
||||
--enable-silent-rules
|
||||
--enable-static=yes
|
||||
--enable-usrp=no
|
||||
--enable-winradio=yes
|
||||
|
@ -81,12 +83,15 @@ jobs:
|
|||
run: grep README Makefile.am
|
||||
- name: configure
|
||||
if: runner.os != 'macOS'
|
||||
run: ./configure ${{ matrix.configure_args }} --enable-silent-rules
|
||||
run: ./configure ${{ matrix.configure_args }}
|
||||
- name: configure on macOS
|
||||
if: runner.os == 'macOS'
|
||||
run: ./configure ${{ matrix.configure_args }} --enable-silent-rules --without-python-binding --without-lua-binding
|
||||
run: ./configure ${{ matrix.configure_args }} --without-lua-binding PYTHON=/opt/homebrew/bin/python3
|
||||
- name: make
|
||||
run: make -j 4 V=0 --no-print-directory
|
||||
- name: make distcheck
|
||||
run: make distcheck V=0 --no-print-directory
|
||||
|
||||
if: runner.os != 'macOS'
|
||||
run: make distcheck V=0 --no-print-directory AM_DISTCHECK_CONFIGURE_FLAGS="${{ matrix.configure_args }} --without-perl-binding"
|
||||
- name: make distcheck on macOS
|
||||
if: runner.os == 'macOS'
|
||||
run: make distcheck V=0 --no-print-directory AM_DISTCHECK_CONFIGURE_FLAGS="${{ matrix.configure_args }} --without-perl-binding --without-lua-binding PYTHON=/opt/homebrew/bin/python3"
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
%include <hamlib/amplist.h>
|
||||
%include <hamlib/amplifier.h>
|
||||
%include <hamlib/amp_state.h>
|
||||
|
||||
%inline %{
|
||||
|
||||
|
|
|
@ -43,6 +43,8 @@ class TestClass:
|
|||
else:
|
||||
properties.append(method_or_property)
|
||||
|
||||
callables.sort()
|
||||
properties.sort()
|
||||
return callables, properties
|
||||
|
||||
|
||||
|
@ -59,8 +61,8 @@ import Hamlib
|
|||
'''
|
||||
filename = f"test_{object_name.replace(".", "_")}_class.py"
|
||||
class_source = inspect.getsource(TestClass)
|
||||
expected_callables = repr(callables)
|
||||
expected_properties = repr(properties)
|
||||
expected_callables = repr(callables).replace(" ", "\n")
|
||||
expected_properties = repr(properties).replace(" ", "\n")
|
||||
|
||||
print(f"Generating {filename}")
|
||||
with open(filename, "w", encoding='utf-8') as output_file:
|
||||
|
|
|
@ -16,12 +16,27 @@ class TestClass:
|
|||
|
||||
def test_callables(self):
|
||||
"""Check that nothing was added or removed"""
|
||||
expected_callables = ['close', 'get_conf', 'get_freq', 'get_info', 'get_level', 'get_powerstat', 'open', 'reset', 'set_conf', 'set_freq', 'set_powerstat', 'token_lookup']
|
||||
expected_callables = ['close',
|
||||
'get_conf',
|
||||
'get_freq',
|
||||
'get_info',
|
||||
'get_level',
|
||||
'get_powerstat',
|
||||
'open',
|
||||
'reset',
|
||||
'set_conf',
|
||||
'set_freq',
|
||||
'set_powerstat',
|
||||
'token_lookup']
|
||||
assert expected_callables == self.actual_callables
|
||||
|
||||
def test_properties(self):
|
||||
"""Check that nothing was added or removed"""
|
||||
expected_properties = ['caps', 'do_exception', 'error_status', 'state', 'thisown']
|
||||
expected_properties = ['caps',
|
||||
'do_exception',
|
||||
'error_status',
|
||||
'state',
|
||||
'thisown']
|
||||
assert expected_properties == self.actual_properties
|
||||
|
||||
@classmethod
|
||||
|
@ -36,4 +51,6 @@ class TestClass:
|
|||
else:
|
||||
properties.append(method_or_property)
|
||||
|
||||
callables.sort()
|
||||
properties.sort()
|
||||
return callables, properties
|
||||
|
|
|
@ -16,12 +16,103 @@ class TestClass:
|
|||
|
||||
def test_callables(self):
|
||||
"""Check that nothing was added or removed"""
|
||||
expected_callables = ['close', 'ext_token_lookup', 'get_ant', 'get_chan_all', 'get_channel', 'get_conf', 'get_ctcss_sql', 'get_ctcss_tone', 'get_dcd', 'get_dcs_code', 'get_dcs_sql', 'get_ext_func', 'get_ext_level', 'get_ext_parm', 'get_freq', 'get_func', 'get_info', 'get_level', 'get_level_f', 'get_level_i', 'get_mem', 'get_mode', 'get_parm', 'get_parm_f', 'get_parm_i', 'get_powerstat', 'get_ptt', 'get_rit', 'get_rptr_offs', 'get_rptr_shift', 'get_split_freq', 'get_split_mode', 'get_split_vfo', 'get_trn', 'get_ts', 'get_vfo', 'get_vfo_info', 'get_xit', 'has_get_level', 'has_scan', 'has_set_func', 'has_set_parm', 'has_vfo_op', 'lookup_mem_caps', 'mem_count', 'open', 'passband_narrow', 'passband_normal', 'passband_wide', 'recv_dtmf', 'reset', 'scan', 'send_dtmf', 'send_morse', 'set_ant', 'set_bank', 'set_channel', 'set_conf', 'set_ctcss_sql', 'set_ctcss_tone', 'set_dcs_code', 'set_dcs_sql', 'set_ext_func', 'set_ext_level', 'set_ext_parm', 'set_freq', 'set_func', 'set_level', 'set_mem', 'set_mode', 'set_parm', 'set_powerstat', 'set_ptt', 'set_rit', 'set_rptr_offs', 'set_rptr_shift', 'set_split_freq', 'set_split_freq_mode', 'set_split_mode', 'set_split_vfo', 'set_trn', 'set_ts', 'set_vfo', 'set_vfo_opt', 'set_xit', 'token_lookup', 'vfo_op']
|
||||
expected_callables = ['close',
|
||||
'ext_token_lookup',
|
||||
'get_ant',
|
||||
'get_chan_all',
|
||||
'get_channel',
|
||||
'get_conf',
|
||||
'get_ctcss_sql',
|
||||
'get_ctcss_tone',
|
||||
'get_dcd',
|
||||
'get_dcs_code',
|
||||
'get_dcs_sql',
|
||||
'get_ext_func',
|
||||
'get_ext_level',
|
||||
'get_ext_parm',
|
||||
'get_freq',
|
||||
'get_func',
|
||||
'get_info',
|
||||
'get_level',
|
||||
'get_level_f',
|
||||
'get_level_i',
|
||||
'get_mem',
|
||||
'get_mode',
|
||||
'get_parm',
|
||||
'get_parm_f',
|
||||
'get_parm_i',
|
||||
'get_powerstat',
|
||||
'get_ptt',
|
||||
'get_rit',
|
||||
'get_rptr_offs',
|
||||
'get_rptr_shift',
|
||||
'get_split_freq',
|
||||
'get_split_mode',
|
||||
'get_split_vfo',
|
||||
'get_trn',
|
||||
'get_ts',
|
||||
'get_vfo',
|
||||
'get_vfo_info',
|
||||
'get_xit',
|
||||
'has_get_level',
|
||||
'has_scan',
|
||||
'has_set_func',
|
||||
'has_set_parm',
|
||||
'has_vfo_op',
|
||||
'lookup_mem_caps',
|
||||
'mem_count',
|
||||
'open',
|
||||
'passband_narrow',
|
||||
'passband_normal',
|
||||
'passband_wide',
|
||||
'recv_dtmf',
|
||||
'reset',
|
||||
'scan',
|
||||
'send_dtmf',
|
||||
'send_morse',
|
||||
'set_ant',
|
||||
'set_bank',
|
||||
'set_channel',
|
||||
'set_conf',
|
||||
'set_ctcss_sql',
|
||||
'set_ctcss_tone',
|
||||
'set_dcs_code',
|
||||
'set_dcs_sql',
|
||||
'set_ext_func',
|
||||
'set_ext_level',
|
||||
'set_ext_parm',
|
||||
'set_freq',
|
||||
'set_func',
|
||||
'set_level',
|
||||
'set_mem',
|
||||
'set_mode',
|
||||
'set_parm',
|
||||
'set_powerstat',
|
||||
'set_ptt',
|
||||
'set_rit',
|
||||
'set_rptr_offs',
|
||||
'set_rptr_shift',
|
||||
'set_split_freq',
|
||||
'set_split_freq_mode',
|
||||
'set_split_mode',
|
||||
'set_split_vfo',
|
||||
'set_trn',
|
||||
'set_ts',
|
||||
'set_vfo',
|
||||
'set_vfo_opt',
|
||||
'set_xit',
|
||||
'token_lookup',
|
||||
'vfo_op']
|
||||
assert expected_callables == self.actual_callables
|
||||
|
||||
def test_properties(self):
|
||||
"""Check that nothing was added or removed"""
|
||||
expected_properties = ['caps', 'do_exception', 'error_status', 'rig', 'state', 'thisown']
|
||||
expected_properties = ['caps',
|
||||
'do_exception',
|
||||
'error_status',
|
||||
'rig',
|
||||
'state',
|
||||
'thisown']
|
||||
assert expected_properties == self.actual_properties
|
||||
|
||||
@classmethod
|
||||
|
@ -36,4 +127,6 @@ class TestClass:
|
|||
else:
|
||||
properties.append(method_or_property)
|
||||
|
||||
callables.sort()
|
||||
properties.sort()
|
||||
return callables, properties
|
||||
|
|
|
@ -16,12 +16,40 @@ class TestClass:
|
|||
|
||||
def test_callables(self):
|
||||
"""Check that nothing was added or removed"""
|
||||
expected_callables = ['close', 'get_conf', 'get_ext_func', 'get_ext_level', 'get_ext_parm', 'get_func', 'get_info', 'get_level', 'get_parm', 'get_position', 'move', 'open', 'park', 'reset', 'set_conf', 'set_ext_func', 'set_ext_level', 'set_ext_parm', 'set_func', 'set_level', 'set_parm', 'set_position', 'stop', 'token_lookup']
|
||||
expected_callables = ['close',
|
||||
'get_conf',
|
||||
'get_ext_func',
|
||||
'get_ext_level',
|
||||
'get_ext_parm',
|
||||
'get_func',
|
||||
'get_info',
|
||||
'get_level',
|
||||
'get_parm',
|
||||
'get_position',
|
||||
'move',
|
||||
'open',
|
||||
'park',
|
||||
'reset',
|
||||
'set_conf',
|
||||
'set_ext_func',
|
||||
'set_ext_level',
|
||||
'set_ext_parm',
|
||||
'set_func',
|
||||
'set_level',
|
||||
'set_parm',
|
||||
'set_position',
|
||||
'stop',
|
||||
'token_lookup']
|
||||
assert expected_callables == self.actual_callables
|
||||
|
||||
def test_properties(self):
|
||||
"""Check that nothing was added or removed"""
|
||||
expected_properties = ['caps', 'do_exception', 'error_status', 'rot', 'state', 'thisown']
|
||||
expected_properties = ['caps',
|
||||
'do_exception',
|
||||
'error_status',
|
||||
'rot',
|
||||
'state',
|
||||
'thisown']
|
||||
assert expected_properties == self.actual_properties
|
||||
|
||||
@classmethod
|
||||
|
@ -36,4 +64,6 @@ class TestClass:
|
|||
else:
|
||||
properties.append(method_or_property)
|
||||
|
||||
callables.sort()
|
||||
properties.sort()
|
||||
return callables, properties
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -63,46 +63,7 @@ class TestClass:
|
|||
assert level is None
|
||||
assert amp.set_powerstat(Hamlib.RIG_POWER_ON) is None
|
||||
assert amp.get_powerstat() == Hamlib.RIG_POWER_ON
|
||||
assert amp.close() is None
|
||||
|
||||
|
||||
def test_all_methods(self):
|
||||
"""Just call all the methods"""
|
||||
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) == ""
|
||||
conf = amp.get_conf("mcfg")
|
||||
assert isinstance(conf, str)
|
||||
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()
|
||||
assert amp.state.comm_state == 0
|
||||
assert amp.open() is None
|
||||
assert amp.state.comm_state == 1
|
||||
info = amp.get_info()
|
||||
assert isinstance(info, str)
|
||||
assert amp.reset(Hamlib.AMP_RESET_FAULT) is None
|
||||
assert amp.set_freq(0) is None
|
||||
assert amp.set_freq(123.45) is None
|
||||
assert amp.get_freq() == 123.45
|
||||
assert amp.get_level(Hamlib.AMP_LEVEL_NONE) is None
|
||||
level = amp.get_level(Hamlib.AMP_LEVEL_SWR)
|
||||
assert isinstance(level, float)
|
||||
level = amp.get_level(Hamlib.AMP_LEVEL_PWR_REFLECTED)
|
||||
assert isinstance(level, int)
|
||||
level = amp.get_level(Hamlib.AMP_LEVEL_FAULT)
|
||||
assert isinstance(level, str)
|
||||
level = amp.get_level(123456)
|
||||
assert level is None
|
||||
assert amp.set_powerstat(Hamlib.RIG_POWER_ON) is None
|
||||
assert amp.get_powerstat() == Hamlib.RIG_POWER_ON
|
||||
assert amp.close() is None
|
||||
assert amp.state.comm_state == 0
|
||||
info = amp.get_info()
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
%include <hamlib/riglist.h>
|
||||
%include <hamlib/rig.h>
|
||||
%include <hamlib/rig_state.h>
|
||||
|
||||
%apply int *OUTPUT { int *};
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
%include <hamlib/rotator.h>
|
||||
%include <hamlib/rotlist.h>
|
||||
%include <hamlib/rot_state.h>
|
||||
|
||||
%inline %{
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue