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

'ExampleWidget' object has no attribute '_impl' when using main branch Travertino #2916

Closed
HalfWhitt opened this issue Oct 16, 2024 · 2 comments · Fixed by beeware/travertino#224
Labels
bug A crash or error in behavior.

Comments

@HalfWhitt
Copy link
Contributor

Describe the bug

I went to start updating #2443 for list and composite properties, but I'm hitting a confusing snag. With up-to-date main branch Toga and 0.3.0 Travertino, all of Toga's tests pass. When I switch to using the up-to-date main branch of Travertino — whose own internal tests all pass — I get a bunch of errors (in style/pack/layout/test_rtl, style/pack/test_apply, and widgets/test_base) that all say AttributeError: 'ExampleWidget' object has no attribute '_impl', or in some cases ExampleNode instead.

Perhaps there's some wrinkle of how I'm swapping in the newer Travertino, and how tox operates, that I don't understand. Is there a best (or better) practice way to do this? I believe I used the same approach months ago (and it worked), but I think that was before the tox configuration was overhauled.

Steps to reproduce

  1. Standard Toga development environment, to start with, on main branch.
  2. Similarly an up-to-date local copy of the main branch of Travertino.
  3. In Travertino's pyproject.toml, I commented out dynamic = ["version"] and added version = "0.3.0", so the dependency resolver will leave me alone.
  4. In Toga's tox.ini, I edited the TOGA_INSTALL_COMMAND by appending the absolute path to my Travertino installation (with the slashes in brackets, like the other paths).
  5. Run tox or tox -m test.
  6. Angry red text

Expected behavior

I would expect Toga's tests to pass.

Screenshots

No response

Environment

  • Toga: 0.4.1.dev1872+g9261f8959.d20241016
  • Travertino: When left dynamic, pip sees it as 0.1.dev701+g4548e9c. I manually edited it to 0.3.0 in pyproject.toml
  • Python: all tested (3.9—3.13)

I don't understand the mechanism by which the dynamic version are determined, though it does seem odd to me that each is lower than the latest release of its respective project, when these are the current main branches. Perhaps I'm reading too much into it.

Logs

FAILED tests/style/pack/layout/test_rtl.py::test_row_box_child_layout - AttributeError: 'ExampleNode' object has no attribute '_impl'
FAILED tests/style/pack/layout/test_rtl.py::test_column_box_child_layout - AttributeError: 'ExampleNode' object has no attribute '_impl'
FAILED tests/style/pack/layout/test_rtl.py::test_alignment_top - AttributeError: 'ExampleNode' object has no attribute '_impl'
FAILED tests/style/pack/layout/test_rtl.py::test_alignment_bottom - AttributeError: 'ExampleNode' object has no attribute '_impl'
FAILED tests/style/pack/layout/test_rtl.py::test_alignment_left - AttributeError: 'ExampleNode' object has no attribute '_impl'
FAILED tests/style/pack/layout/test_rtl.py::test_alignment_right - AttributeError: 'ExampleNode' object has no attribute '_impl'
FAILED tests/style/pack/test_apply.py::test_set_default_right_textalign_when_rtl - AttributeError: 'ExampleNode' object has no attribute '_impl'
FAILED tests/style/pack/test_apply.py::test_set_center_alignment - AttributeError: 'ExampleNode' object has no attribute '_impl'
FAILED tests/style/pack/test_apply.py::test_set_color - AttributeError: 'ExampleNode' object has no attribute '_impl'
FAILED tests/style/pack/test_apply.py::test_set_background_color - AttributeError: 'ExampleNode' object has no attribute '_impl'
FAILED tests/style/pack/test_apply.py::test_set_font - AttributeError: 'ExampleNode' object has no attribute '_impl'
FAILED tests/style/pack/test_apply.py::test_set_visibility_hidden - AttributeError: 'ExampleNode' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_widget_created - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_add_child_without_app - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_add_child - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_child_square_bracket_access - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_get_index_of_children - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_replace_child_with_non_child - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_add_multiple_children - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_reparent_child - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_reparent_child_to_self - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_insert_child_without_app - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_insert_child - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_insert_position - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_insert_bad_position - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_insert_reparent_child - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_insert_reparent_child_to_self - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_remove_child_without_app - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_remove_child - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_remove_multiple_children - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_clear_all_children - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_clear_no_children - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_remove_from_non_parent - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_set_app - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_set_app_with_children - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_set_same_app - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_reset_app - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_set_new_app - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_set_window - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_set_window_with_children - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_reset_window - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_unset_window - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_enabled[None-False] - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_enabled[-False] - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_enabled[true-True] - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_enabled[false-True] - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_enabled[0-False] - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_enabled[1234-True] - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_refresh_root - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_refresh_child - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_focus - AttributeError: 'ExampleWidget' object has no attribute '_impl'
ERROR tests/widgets/test_base.py::test_tab_index - AttributeError: 'ExampleWidget' object has no attribute '_impl'

Additional context

No response

@freakboy3742
Copy link
Member

I can definitely confirm that I'm seeing this set of errors; an initial inspection seems to point at a subtle change in the order in which the Applicator is used to apply styles. With an updated Travertino, the changes are being applied at time of creation of the Style object, at which point the widget may not have been fully instantiated.

I don't have any good ideas about what has changed that has caused this to become an issue, though.

@HalfWhitt
Copy link
Contributor Author

Well, at least that confirms that it is indeed a change in Travertino, and not something weird going on with my environment configuration. I'll poke at it further when I find time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A crash or error in behavior.
Projects
None yet
2 participants