ARMmbed / mbed-os-tools

The tools to test and work with Mbed OS
Apache License 2.0
33 stars 67 forks source link

mbed-host-tests tests fail with Python 3.12 #289

Open knowledgejunkie opened 6 months ago

knowledgejunkie commented 6 months ago

Description

The mbed-host-tests package fails to build on Debian sid with Python 3.12, due to failing tests.

The failures are due to the stricter assertion checks in 3.12, which forbid assertions starting with "called_once..."

Relevant part (hopefully):

make[1]: Entering directory '/<>' python3 setup.py egg_info running egg_info creating mbed_host_tests.egg-info writing mbed_host_tests.egg-info/PKG-INFO writing dependency_links to mbed_host_tests.egg-info/dependency_links.txt writing entry points to mbed_host_tests.egg-info/entry_points.txt writing requirements to mbed_host_tests.egg-info/requires.txt writing top-level names to mbed_host_tests.egg-info/top_level.txt writing manifest file 'mbed_host_tests.egg-info/SOURCES.txt' reading manifest file 'mbed_host_tests.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' adding license file 'LICENSE' writing manifest file 'mbed_host_tests.egg-info/SOURCES.txt' PYBUILD_SYSTEM=custom \ PYBUILD_TEST_ARGS="{interpreter} -m unittest discover -v -s test -p \".py\" -t {dir}" \ dh_auto_test pybuild --test -i python{version} -p "3.12 3.11" D: pybuild pybuild:601: version: 6.20231223 D: pybuild pybuild:602: ['/usr/bin/pybuild', '--test', '-i', 'python{version}', '-p', '3.12 3.11'] D: pybuild pybuild:39: cfg: Namespace(verbose=True, quiet=False, really_quiet=False, detect_only=False, clean_only=False, configure_only=False, build_only=False, install_only=False, test_only=True, autopkgtest_only=False, list_systems=False, print_args=None, before_clean=None, clean_args=None, after_clean=None, before_configure=None, configure_args=None, after_configure=None, before_build=None, build_args=None, after_build=None, before_install=None, install_args=None, after_install=None, before_test=None, test_args=None, after_test=None, test_nose=False, test_nose2=False, test_pytest=False, test_tox=False, test_custom=False, dir='/<>', destdir='debian/tmp', ext_destdir=None, ext_pattern='\.so(\.[^/])?$', ext_sub_pattern=None, ext_sub_repl=None, install_dir=None, name='mbed-host-tests', system='custom', versions=['3.12', '3.11'], interpreter=['python{version}'], disable=None, custom_tests=True) D: pybuild init:37: cannot initialize 'cmake' plugin: Missing command 'cmake' D: pybuild init:37: cannot initialize 'meson' plugin: Missing command 'meson' D: pybuild tools:231: invoking: /usr/bin/dpkg-architecture D: pybuild pybuild:151: detected build system: custom (certainty: 99%) I: pybuild base:305: python3.12 -m unittest discover -v -s test -p ".py" -t /<> D: pybuild tools:231: invoking: python3.12 -m unittest discover -v -s test -p ".py" -t /<> /<>/mbed_host_tests/host_tests_plugins/module_reset_mbed.py:42: SyntaxWarning: invalid escape sequence '\d' self.re_float = re.compile("^\d+.\d+") /<>/test/host_test_os_detect.py:33: SyntaxWarning: invalid escape sequence '\d' self.re_float = re.compile("^\d+.\d+$") test_example (test.basic.BasicTestCase.test_example) ... ok test_get_plugin_caps (test.basic_ht.BasicHostTestsTestCase.test_get_plugin_caps) ... ok test_constructor (test.conn_primitive_remote.ConnPrimitiveRemoteTestCase.test_constructor) ... [1708816588.49][remote][INF] remote resources initialization: remote(host=None, port=8000) [1708816588.49][remote][INF] remote resources count: 1 [1708816588.49][remote][INF] remote resources flashing with 'test.bin'... [1708816588.49][remote][INF] opening connection to platform at baudrate='9600' [1708816588.49][remote][INF] remote resources reset... ERROR test_finish (test.conn_primitive_remote.ConnPrimitiveRemoteTestCase.test_finish) ... [1708816588.49][remote][INF] remote resources initialization: remote(host=None, port=8000) [1708816588.49][remote][INF] remote resources count: 1 [1708816588.49][remote][INF] remote resources flashing with 'test.bin'... [1708816588.49][remote][INF] opening connection to platform at baudrate='9600' [1708816588.49][remote][INF] remote resources reset... ok test_read (test.conn_primitive_remote.ConnPrimitiveRemoteTestCase.test_read) ... [1708816588.49][remote][INF] remote resources initialization: remote(host=None, port=8000) [1708816588.49][remote][INF] remote resources count: 1 [1708816588.49][remote][INF] remote resources flashing with 'test.bin'... [1708816588.50][remote][INF] opening connection to platform at baudrate='9600' [1708816588.50][remote][INF] remote resources reset... ok test_reset (test.conn_primitive_remote.ConnPrimitiveRemoteTestCase.test_reset) ... [1708816588.50][remote][INF] remote resources initialization: remote(host=None, port=8000) [1708816588.50][remote][INF] remote resources count: 1 [1708816588.50][remote][INF] remote resources flashing with 'test.bin'... [1708816588.50][remote][INF] opening connection to platform at baudrate='9600' [1708816588.50][remote][INF] remote resources reset... [1708816588.50][remote][INF] remote resources reset... ok test_write (test.conn_primitive_remote.ConnPrimitiveRemoteTestCase.test_write) ... [1708816588.50][remote][INF] remote resources initialization: remote(host=None, port=8000) [1708816588.50][remote][INF] remote resources count: 1 [1708816588.50][remote][INF] remote resources flashing with 'test.bin'... [1708816588.50][remote][INF] opening connection to platform at baudrate='9600' [1708816588.50][remote][INF] remote resources reset... ok test_event_callback_decorator (test.event_callback_decorator.TestEvenCallbackDecorator.test_event_callback_decorator) ... ok test_get_host_test (test.host_registry.HostRegistryTestCase.test_get_host_test) ... ok test_host_test_has_name_attribute (test.host_registry.HostRegistryTestCase.test_host_test_has_name_attribute) ... ok test_host_test_str_not_empty (test.host_registry.HostRegistryTestCase.test_host_test_str_not_empty) ... ok test_is_host_test (test.host_registry.HostRegistryTestCase.test_is_host_test) ... ok test_register_host_test (test.host_registry.HostRegistryTestCase.test_register_host_test) ... ok test_unregister_host_test (test.host_registry.HostRegistryTestCase.test_unregister_host_test) ... ok test_host_test_has_no_rampUpDown_attribute (test.host_test_base.BaseHostTestTestCase.test_host_test_has_no_rampUpDown_attribute) ... ok test_host_test_has_setup_teardown_attribute (test.host_test_base.BaseHostTestTestCase.test_host_test_has_setup_teardown_attribute) ... ok test_detect_os_support_ext (test.host_test_os_detect.HostOSDetectionTestCase.test_detect_os_support_ext) ... ok test_os_info (test.host_test_os_detect.HostOSDetectionTestCase.test_os_info) ... ok test_os_support (test.host_test_os_detect.HostOSDetectionTestCase.test_os_support) ... ok test_supported_os_name (test.host_test_os_detect.HostOSDetectionTestCase.test_supported_os_name) ... ok test_examle (test.host_test_plugins.HostOSDetectionTestCase.test_examle) ... ok test_pyserial_version_detect (test.host_test_plugins.HostOSDetectionTestCase.test_pyserial_version_detect) ... ok test_host_test_class_has_test_attr (test.host_test_scheme.HostRegistryTestCase.test_host_test_class_has_test_attr) Check if host test has 'result' class member ... ok test_host_test_class_test_attr_callable (test.host_test_scheme.HostRegistryTestCase.test_host_test_class_test_attr_callable) Check if host test has callable 'result' class member ... ok test_host_test_class_test_attr_callable_args_num (test.host_test_scheme.HostRegistryTestCase.test_host_test_class_test_attr_callable_args_num) Check if host test has callable setup(), result() and teardown() class member has 2 arguments ... ok test_copy_bin (test.mps2_copy.MPS2CopyTestCase.test_copy_bin) ... ok test_copy_elf (test.mps2_copy.MPS2CopyTestCase.test_copy_elf) ... ok test_check_sync (test.mps2_reset.MPS2ResetTestCase.test_check_sync) ... ok

====================================================================== ERROR: test_constructor (test.conn_primitive_remote.ConnPrimitiveRemoteTestCase.test_constructor)

Traceback (most recent call last): File "/<>/test/conn_primitive_remote.py", line 84, in test_constructor self.remote.client.get_resources.called_once() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/mock/mock.py", line 695, in getattr raise AttributeError( AttributeError: 'called_once' is not a valid assertion. Use a spec for the mock if 'called_once' is meant to be an attribute.


Ran 28 tests in 0.252s

FAILED (errors=1) E: pybuild pybuild:391: test: plugin custom failed with: exit code=1: python3.12 -m unittest discover -v -s test -p ".py" -t /<> Traceback (most recent call last): File "/usr/bin/pybuild", line 389, in main run(func, i, version, c) File "/usr/bin/pybuild", line 327, in run result = func(context, args) ^^^^^^^^^^^^^^^^^^^ File "/usr/share/dh-python/dhpython/build/base.py", line 359, in wrapped_func raise Exception(msg) Exception: exit code=1: python3.12 -m unittest discover -v -s test -p ".py" -t /<> I: pybuild base:305: python3.11 -m unittest discover -v -s test -p ".py" -t /<> D: pybuild tools:231: invoking: python3.11 -m unittest discover -v -s test -p ".py" -t /<> test_example (test.basic.BasicTestCase.test_example) ... ok test_get_plugin_caps (test.basic_ht.BasicHostTestsTestCase.test_get_plugin_caps) ... ok test_constructor (test.conn_primitive_remote.ConnPrimitiveRemoteTestCase.test_constructor) ... [1708816589.04][remote][INF] remote resources initialization: remote(host=None, port=8000) [1708816589.04][remote][INF] remote resources count: 1 [1708816589.04][remote][INF] remote resources flashing with 'test.bin'... [1708816589.04][remote][INF] opening connection to platform at baudrate='9600' [1708816589.04][remote][INF] remote resources reset... ERROR test_finish (test.conn_primitive_remote.ConnPrimitiveRemoteTestCase.test_finish) ... [1708816589.04][remote][INF] remote resources initialization: remote(host=None, port=8000) [1708816589.04][remote][INF] remote resources count: 1 [1708816589.04][remote][INF] remote resources flashing with 'test.bin'... [1708816589.04][remote][INF] opening connection to platform at baudrate='9600' [1708816589.04][remote][INF] remote resources reset... ok test_read (test.conn_primitive_remote.ConnPrimitiveRemoteTestCase.test_read) ... [1708816589.05][remote][INF] remote resources initialization: remote(host=None, port=8000) [1708816589.05][remote][INF] remote resources count: 1 [1708816589.05][remote][INF] remote resources flashing with 'test.bin'... [1708816589.05][remote][INF] opening connection to platform at baudrate='9600' [1708816589.05][remote][INF] remote resources reset... ok test_reset (test.conn_primitive_remote.ConnPrimitiveRemoteTestCase.test_reset) ... [1708816589.05][remote][INF] remote resources initialization: remote(host=None, port=8000) [1708816589.05][remote][INF] remote resources count: 1 [1708816589.05][remote][INF] remote resources flashing with 'test.bin'... [1708816589.05][remote][INF] opening connection to platform at baudrate='9600' [1708816589.05][remote][INF] remote resources reset... [1708816589.05][remote][INF] remote resources reset... ok test_write (test.conn_primitive_remote.ConnPrimitiveRemoteTestCase.test_write) ... [1708816589.05][remote][INF] remote resources initialization: remote(host=None, port=8000) [1708816589.05][remote][INF] remote resources count: 1 [1708816589.05][remote][INF] remote resources flashing with 'test.bin'... [1708816589.05][remote][INF] opening connection to platform at baudrate='9600' [1708816589.05][remote][INF] remote resources reset... ok test_event_callback_decorator (test.event_callback_decorator.TestEvenCallbackDecorator.test_event_callback_decorator) ... ok test_get_host_test (test.host_registry.HostRegistryTestCase.test_get_host_test) ... ok test_host_test_has_name_attribute (test.host_registry.HostRegistryTestCase.test_host_test_has_name_attribute) ... ok test_host_test_str_not_empty (test.host_registry.HostRegistryTestCase.test_host_test_str_not_empty) ... ok test_is_host_test (test.host_registry.HostRegistryTestCase.test_is_host_test) ... ok test_register_host_test (test.host_registry.HostRegistryTestCase.test_register_host_test) ... ok test_unregister_host_test (test.host_registry.HostRegistryTestCase.test_unregister_host_test) ... ok test_host_test_has_no_rampUpDown_attribute (test.host_test_base.BaseHostTestTestCase.test_host_test_has_no_rampUpDown_attribute) ... ok test_host_test_has_setup_teardown_attribute (test.host_test_base.BaseHostTestTestCase.test_host_test_has_setup_teardown_attribute) ... ok test_detect_os_support_ext (test.host_test_os_detect.HostOSDetectionTestCase.test_detect_os_support_ext) ... ok test_os_info (test.host_test_os_detect.HostOSDetectionTestCase.test_os_info) ... ok test_os_support (test.host_test_os_detect.HostOSDetectionTestCase.test_os_support) ... ok test_supported_os_name (test.host_test_os_detect.HostOSDetectionTestCase.test_supported_os_name) ... ok test_examle (test.host_test_plugins.HostOSDetectionTestCase.test_examle) ... ok test_pyserial_version_detect (test.host_test_plugins.HostOSDetectionTestCase.test_pyserial_version_detect) ... ok test_host_test_class_has_test_attr (test.host_test_scheme.HostRegistryTestCase.test_host_test_class_has_test_attr) Check if host test has 'result' class member ... ok test_host_test_class_test_attr_callable (test.host_test_scheme.HostRegistryTestCase.test_host_test_class_test_attr_callable) Check if host test has callable 'result' class member ... ok test_host_test_class_test_attr_callable_args_num (test.host_test_scheme.HostRegistryTestCase.test_host_test_class_test_attr_callable_args_num) Check if host test has callable setup(), result() and teardown() class member has 2 arguments ... ok test_copy_bin (test.mps2_copy.MPS2CopyTestCase.test_copy_bin) ... ok test_copy_elf (test.mps2_copy.MPS2CopyTestCase.test_copy_elf) ... ok test_check_sync (test.mps2_reset.MPS2ResetTestCase.test_check_sync) ... ok

====================================================================== ERROR: test_constructor (test.conn_primitive_remote.ConnPrimitiveRemoteTestCase.test_constructor)

Traceback (most recent call last): File "/<>/test/conn_primitive_remote.py", line 84, in test_constructor self.remote.client.get_resources.called_once() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/mock/mock.py", line 695, in getattr raise AttributeError( AttributeError: 'called_once' is not a valid assertion. Use a spec for the mock if 'called_once' is meant to be an attribute.


Ran 28 tests in 0.037s

FAILED (errors=1) E: pybuild pybuild:391: test: plugin custom failed with: exit code=1: python3.11 -m unittest discover -v -s test -p ".py" -t /<> Traceback (most recent call last): File "/usr/bin/pybuild", line 389, in main run(func, i, version, c) File "/usr/bin/pybuild", line 327, in run result = func(context, args) ^^^^^^^^^^^^^^^^^^^ File "/usr/share/dh-python/dhpython/build/base.py", line 359, in wrapped_func raise Exception(msg) Exception: exit code=1: python3.11 -m unittest discover -v -s test -p ".py" -t /<> rm -fr -- /tmp/dh-xdg-rundir-sbYE4_K1 dh_auto_test: error: pybuild --test -i python{version} -p "3.12 3.11" returned exit code 13

The full build log is available from: http://qa-logs.debian.net/2024/02/24/python-mbed-host-tests_1.4.4-9_unstable.log

The Debian bug report is here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1064706

Issue request type

[ ] Question
[ ] Enhancement
[X] Bug