Skip to content

Testsuite failure with Python 3.14 #720

@rolandmas

Description

@rolandmas

Hi, your friendly Debian package maintainer here.

As reported in https://bugs.debian.org/1123148 the testsuite for magicgui errors out when run on Python 3.14 (it runs fine on 3.13). I can reproduce the error locally.

To Reproduce
Steps to reproduce the behavior: run the testsuite on Python 3.14.

Screenshots
Here's the build log with the failures:

============================= test session starts ==============================
platform linux -- Python 3.14.2, pytest-9.0.2, pluggy-1.6.0
PyQt5 5.15.11 -- Qt runtime 5.15.17 -- Qt compiled 5.15.17
rootdir: /<<PKGBUILDDIR>>/.pybuild/cpython3_3.14_magicgui/build
configfile: pyproject.toml
testpaths: tests
plugins: qt-4.4.0, xvfb-3.0.0, typeguard-4.4.4
collected 351 items / 2 deselected / 3 skipped / 349 selected

tests/test_application.py .                                              [  0%]
tests/test_backends.py s.........                                        [  3%]
tests/test_container.py ...............                                  [  7%]
tests/test_docs.py ss                                                    [  8%]
tests/test_factory.py ..........                                         [ 10%]
tests/test_gui_class.py ......                                           [ 12%]
tests/test_magicgui.py .....F..........F..x......................F...... [ 26%]
......                                                                   [ 28%]
tests/test_persistence.py ...                                            [ 29%]
tests/test_signature.py ...F                                             [ 30%]
tests/test_table.py ............................sss..........            [ 42%]
tests/test_types.py ..................                                   [ 47%]
tests/test_ui_field.py s.ss....ss.                                       [ 50%]
tests/test_util.py ............                                          [ 53%]
tests/test_widgets.py ......s.s..ss..s.ss..ss.sss.s..s...........s...... [ 68%]
s.s.......s..s.......................................................... [ 88%]
.......................................                                  [100%]

=================================== FAILURES ===================================
____________________________ test_bind_out_of_order ____________________________

    def test_bind_out_of_order():
        """Test that binding a value before a non-default argument still gives message."""
    
        @magicgui(a={"bind": 10})
        def func(a, x):
            pass
    
        assert isinstance(func.a, widgets.EmptyWidget)
        with pytest.raises(TypeError) as e:
            func()
        assert "missing a required argument" in str(e)
>       assert "@magicgui(x={'bind': value})" in str(e)
E       assert "@magicgui(x={'bind': value})" in '<ExceptionInfo TypeError("missing a required argument: \'x\' in call to \'func(x: Annotated[inspect._empty, {\'enable...rue, \'visible\': False}], a: Annotated[inspect._empty, {\'enabled\': True, \'visible\': False}] = 10): ...") tblen=2>'
E        +  where '<ExceptionInfo TypeError("missing a required argument: \'x\' in call to \'func(x: Annotated[inspect._empty, {\'enable...rue, \'visible\': False}], a: Annotated[inspect._empty, {\'enabled\': True, \'visible\': False}] = 10): ...") tblen=2>' = str(<ExceptionInfo TypeError("missing a required argument: 'x' in call to 'func(x: Annotated[inspect._empty, {'enabled': T...led': True, 'visible': False}], a: Annotated[inspect._empty, {'enabled': True, 'visible': False}] = 10): ...") tblen=2>)

tests/test_magicgui.py:134: AssertionError
_____________________________ test_signature_repr ______________________________

    def test_signature_repr():
        """Test that the gui makes a proper signature."""
    
        def func(a: str = "string", b: int = 3, c: float = 7.1):
            return locals()
    
        magic_func = magicgui(func)
    
        # the STRING signature representation should be the same as the original function
>       assert str(inspect.signature(magic_func)) == str(inspect.signature(func))
E       assert '(a: Annotate...None}] = 7.1)' == "(a: str = 's... float = 7.1)"
E         
E         - (a: str = 'string', b: int = 3, c: float = 7.1)
E         + (a: Annotated[str, {'enabled': True, 'visible': False}] = 'string', b: Annotated[int, {'enabled': True, 'visible': False, 'min': 0, 'max': 999, 'step': None}] = 3, c: Annotated[float, {'enabled': True, 'visible': False, 'min': 0.0, 'max': 999.0, 'step': None}] = 7.1)

tests/test_magicgui.py:317: AssertionError
______________________________ test_none_defaults ______________________________

    def test_none_defaults():
        """Make sure that an unannotated parameter with default=None is ok."""
        assert widgets.create_widget(value=None, raise_on_unknown=False).value is None
    
        def func(arg=None):
            return 1
    
        assert magicgui(func)() == 1
    
>       assert str(magic_signature(func)) == str(magicgui(func).__signature__)
E       AssertionError: assert '(arg: Annota..., {}] = None)' == '(arg: Annota...lse}] = None)'
E         
E         - (arg: Annotated[inspect._empty, {'enabled': True, 'visible': False}] = None)
E         + (arg: Annotated[inspect._empty, {}] = None)

tests/test_magicgui.py:774: AssertionError
_________________________ test_signature_to_container __________________________

    def test_signature_to_container():
        """Test that a MagicSignature can make a container."""
        sig = magic_signature(_sample_func, gui_options={"a": {"widget_type": "Slider"}})
        container = sig.to_container()
        assert len(container) == 2
>       assert repr(container) == "<Container (a: int = 0, b: str = 'hi')>"
E       assert "<Container (...se}] = 'hi')>" == "<Container (... str = 'hi')>"
E         
E         - <Container (a: int = 0, b: str = 'hi')>
E         + <Container (a: Annotated[int, {'enabled': True, 'visible': False, 'min': 0, 'max': 999, 'step': None, 'orientation': 'horizontal', 'readout': True}] = 0, b: Annotated[str, {'enabled': True, 'visible': False}] = 'hi')>

tests/test_signature.py:43: AssertionError
=========================== short test summary info ============================
FAILED tests/test_magicgui.py::test_bind_out_of_order - assert "@magicgui(x={...
FAILED tests/test_magicgui.py::test_signature_repr - assert '(a: Annotate...N...
FAILED tests/test_magicgui.py::test_none_defaults - AssertionError: assert '(...
FAILED tests/test_signature.py::test_signature_to_container - assert "<Contai...
====== 4 failed, 314 passed, 33 skipped, 2 deselected, 1 xfailed in 4.34s ======

Environment (please complete the following information):

  • OS: Debian unstable
  • magicgui version: reproducible with 0.9.1 and 0.10.1.

Thanks :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions