Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for latest urwid #1330

Closed
fabaff opened this issue Jan 24, 2024 · 1 comment
Closed

Support for latest urwid #1330

fabaff opened this issue Jan 24, 2024 · 1 comment

Comments

@fabaff
Copy link

fabaff commented Jan 24, 2024

Describe the bug
A test (test_convert_to_date) fails. I guess that DeprecationWarnings are already on the radar.

To Reproduce
Run pytest with the latest urwid installed.

============================= test session starts ==============================
platform linux -- Python 3.11.7, pytest-7.4.3, pluggy-1.3.0
rootdir: /build/source
plugins: hypothesis-6.91.0
collected 315 items / 5 deselected / 310 selected                              

tests/backend_test.py ..............................                     [  9%]
[...]
tests/vtimezone_test.py ..                                               [ 96%]
tests/ui/test_calendarwidget.py .....                                    [ 98%]
tests/ui/test_editor.py ...F                                             [ 99%]
tests/ui/test_widgets.py .                                               [100%]

=================================== FAILURES ===================================
_____________________________ test_convert_to_date _____________________________

    def test_convert_to_date():
        """test for the issue in #666"""
        editor = StartEndEditor(
            BERLIN.localize(dt.datetime(2017, 10, 2, 13)),
            BERLIN.localize(dt.datetime(2017, 10, 4, 18)),
            conf=CONF
        )
>       canvas = editor.render((50, ), True)

tests/ui/test_editor.py:106: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/nix/store/karvk8vcyr86y5mqd1xb5q6ym8vw6yby-python3.11-urwid-2.4.3/lib/python3.11/site-packages/urwid/widget/widget.py:112: in cached_render
[...]
    validate_size(self, size, canv)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

widget = <Padding selectable fixed/flow widget <CalendarPopUp selectable flow widget <ValidatedEdit selectable flow widget>> right=1 width=11>
size = (10,)
canv = <CompositeCanvas finalized=False cols=11 rows=1 cursor=(10, 0) children=(<CompositeCanvas finalized=True cols=11 rows=... at 0x7FFFE6818C10>) at 0x7FFFE6818D10>) at 0x7FFFE6818F90>) at 0x7FFFE6819190>) at 0x7FFFE68193D0>) at 0x7FFFE6819610>

    def validate_size(widget, size, canv):
        """
        Raise a WidgetError if a canv does not match size.
        """
        if (size and size[1:] != (0,) and size[0] != canv.cols()) or (len(size) > 1 and size[1] != canv.rows()):
>           raise WidgetError(
                f"Widget {widget!r} rendered ({canv.cols():d} x {canv.rows():d}) canvas when passed size {size!r}!"
            )
E           urwid.widget.widget.WidgetError: Widget <Padding selectable fixed/flow widget <CalendarPopUp selectable flow widget <ValidatedEdit selectable flow widget>> right=1 width=11> rendered (11 x 1) canvas when passed size (10,)!

/nix/store/karvk8vcyr86y5mqd1xb5q6ym8vw6yby-python3.11-urwid-2.4.3/lib/python3.11/site-packages/urwid/widget/widget.py:92: WidgetError
=============================== warnings summary ===============================
tests/backend_test.py:5
  /build/source/tests/backend_test.py:5: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
    import pkg_resources
[...]
  /build/source/khal/ui/widgets.py:294: PendingDeprecationWarning: only for backwards compatibility.You may also use the new standard container property `focus_position` to get the focus.
    self.set_focus(i)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED tests/ui/test_editor.py::test_convert_to_date - urwid.widget.widget.WidgetError: Widget <Padding selectable fixed/flow widg...
= 1 failed, 306 passed, 5 deselected, 1 xfailed, 2 xpassed, 178 warnings in 3.92s =

Expected behavior
Tests to pass.

OS, version, khal version and how you installed it:

  • The output of khal --version: 0.11.2
  • Installation method [e.g. PyPI, git, OS repo]: OS
  • python version [e.g. python 3.9]
  • OS [e.g. arch]
  • Your khal config file
  • The versions of your other python packages [e.g. the output of pip freeze]: 3.11

Additional context
Only an issue for distributions, will probably not affect users who are working with venvs.

@geier
Copy link
Member

geier commented Feb 12, 2024

Thank you for the bug report!

Should be fixed with v0.11.3 and also in master.

@geier geier closed this as completed Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants