You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the latest main branch of toga, at the beginning of every test of testbed, an "Open File Dialog" is being shown, which has input focus. Consequently the testbed test_app.py::test_current_window test fails as the input focus is on the dialog instead of on the main window.
Steps to reproduce
Clone the latest toga main branch
git clone https://github.com/beeware/toga.git
cd toga/testbed
Run the testbed test_app.py::test_current_window:
briefcase dev -r --test -- tests/app/test_desktop.py::test_current_window -s
Notice a "Open File dialog" being shown from the start of the test:
Get Error Message:
[testbed] Running test suite in dev environment...
===========================================================================
Waiting for app to be ready for testing... ready.
============================= test session starts ==============================
collecting ... collected 1 item
tests/app/test_desktop.py::test_current_window FAILED
=================================== FAILURES ===================================
_____________________________ test_current_window ______________________________
Traceback (most recent call last):
File "/Users/proneon267/venv/lib/python3.12/site-packages/_pytest/runner.py", line 341, in from_call
result: TResult | None = func()
^^^^^^
File "/Users/proneon267/venv/lib/python3.12/site-packages/_pytest/runner.py", line 242, in <lambda>
lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/proneon267/venv/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/proneon267/venv/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/proneon267/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 139, in _multicall
raise exception.with_traceback(exception.__traceback__)
File "/Users/proneon267/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 122, in _multicall
teardown.throw(exception) # type: ignore[union-attr]
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/proneon267/venv/lib/python3.12/site-packages/_pytest/threadexception.py", line 92, in pytest_runtest_call
yield from thread_exception_runtest_hook()
File "/Users/proneon267/venv/lib/python3.12/site-packages/_pytest/threadexception.py", line 68, in thread_exception_runtest_hook
yield
File "/Users/proneon267/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 122, in _multicall
teardown.throw(exception) # type: ignore[union-attr]
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/proneon267/venv/lib/python3.12/site-packages/_pytest/unraisableexception.py", line 95, in pytest_runtest_call
yield from unraisable_exception_runtest_hook()
File "/Users/proneon267/venv/lib/python3.12/site-packages/_pytest/unraisableexception.py", line 70, in unraisable_exception_runtest_hook
yield
File "/Users/proneon267/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 122, in _multicall
teardown.throw(exception) # type: ignore[union-attr]
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/proneon267/venv/lib/python3.12/site-packages/_pytest/logging.py", line 846, in pytest_runtest_call
yield from self._runtest_for(item, "call")
File "/Users/proneon267/venv/lib/python3.12/site-packages/_pytest/logging.py", line 829, in _runtest_for
yield
File "/Users/proneon267/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 122, in _multicall
teardown.throw(exception) # type: ignore[union-attr]
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/proneon267/venv/lib/python3.12/site-packages/_pytest/capture.py", line 880, in pytest_runtest_call
return (yield)
^^^^^
File "/Users/proneon267/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 122, in _multicall
teardown.throw(exception) # type: ignore[union-attr]
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/proneon267/venv/lib/python3.12/site-packages/_pytest/skipping.py", line 257, in pytest_runtest_call
return (yield)
^^^^^
File "/Users/proneon267/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
res = hook_impl.function(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/proneon267/venv/lib/python3.12/site-packages/_pytest/runner.py", line 174, in pytest_runtest_call
item.runtest()
File "/Users/proneon267/venv/lib/python3.12/site-packages/pytest_asyncio/plugin.py", line 457, in runtest
super().runtest()
File "/Users/proneon267/venv/lib/python3.12/site-packages/_pytest/python.py", line 1627, in runtest
self.ihook.pytest_pyfunc_call(pyfuncitem=self)
File "/Users/proneon267/venv/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/proneon267/venv/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/proneon267/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 182, in _multicall
return outcome.get_result()
^^^^^^^^^^^^^^^^^^^^
File "/Users/proneon267/venv/lib/python3.12/site-packages/pluggy/_result.py", line 100, in get_result
raise exc.with_traceback(exc.__traceback__)
File "/Users/proneon267/venv/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
res = hook_impl.function(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/proneon267/venv/lib/python3.12/site-packages/_pytest/python.py", line 159, in pytest_pyfunc_call
result = testfunction(**testargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/proneon267/venv/lib/python3.12/site-packages/pytest_asyncio/plugin.py", line 929, in inner
_loop.run_until_complete(task)
File "/Users/proneon267/toga/testbed/tests/conftest.py", line 142, in run_until_complete
return asyncio.run_coroutine_threadsafe(coro, self.loop).result()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/proneon267/.pyenv/versions/3.12.4/lib/python3.12/concurrent/futures/_base.py", line 456, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "/Users/proneon267/.pyenv/versions/3.12.4/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/Users/proneon267/toga/testbed/tests/app/test_desktop.py", line 353, in test_current_window
assert app.current_window == main_window
File "/Users/proneon267/venv/lib/python3.12/site-packages/toga/app.py", line 831, in current_window
return window.interface
^^^^^^^^^^^^^^^^
File "/Users/proneon267/venv/lib/python3.12/site-packages/rubicon/objc/api.py", line 1097, in __getattr__
raise AttributeError(
AttributeError: rubicon.objc.api.ObjCInstance NSOpenPanel has no attribute interface
=========================== short test summary info ============================
FAILED tests/app/test_desktop.py::test_current_window - AttributeError: rubicon.objc.api.ObjCInstance NSOpenPanel has no attribute interface
============================== 1 failed in 0.63s ===============================
Expected behavior
The "Open File Dialog" should not be shown at the start of the test.
Screenshots
No response
Environment
Operating System: macOS 14.6
Python version: 3.12
Software versions:
Briefcase: 0.3.19
Toga: latest main branch
...
Logs
No logs generated.
Additional context
The bugs seems to have been arisen out of the following addition of the document_types to the testbed:
As without specifying the document_types, the testbed test_app.py::test_current_window test passes and no "Open File Dialog" is shown at the beginning of the test.
This problem is also arising on the linux-wayland testbed, as evident by the CI failures of input focus related widget tests.
The text was updated successfully, but these errors were encountered:
Huh... so it is. It looks like this is a side effect of the rework of Document-based apps; by adding document definitions to the testbed app (so that we can test document features), that has triggered the "file open" logic on a new app.
That shouldn't be happening, because the app isn't a full "document-based" app - so something definitely needs to be fixed here.
Describe the bug
With the latest main branch of toga, at the beginning of every test of testbed, an "Open File Dialog" is being shown, which has input focus. Consequently the testbed
test_app.py::test_current_window
test fails as the input focus is on the dialog instead of on the main window.Steps to reproduce
Notice a "Open File dialog" being shown from the start of the test:
Get Error Message:
Expected behavior
The "Open File Dialog" should not be shown at the start of the test.
Screenshots
No response
Environment
Logs
Additional context
The bugs seems to have been arisen out of the following addition of the document_types to the testbed:
toga/testbed/src/testbed/app.py
Lines 225 to 229 in 8bec404
As without specifying the document_types, the testbed
test_app.py::test_current_window
test passes and no "Open File Dialog" is shown at the beginning of the test.This problem is also arising on the linux-wayland testbed, as evident by the CI failures of input focus related widget tests.
The text was updated successfully, but these errors were encountered: