Skip to content

Commit

Permalink
Merge pull request #2918 from HalfWhitt/app-condtional
Browse files Browse the repository at this point in the history
Set App.app to initial value of None  to avoid AttributeError in teardown
  • Loading branch information
freakboy3742 authored Oct 17, 2024
2 parents 9261f89 + 671b9c3 commit 261e356
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions changes/2918.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
App.app is now set to an initial value of None, before an app instance is created. This avoids a potential Attribute Error in testing teardown.
5 changes: 3 additions & 2 deletions core/src/toga/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,9 @@ def _remove(self, id: str) -> None:

class App:
#: The currently running :class:`~toga.App`. Since there can only be one running
#: Toga app in a process, this is available as a class property via ``toga.App.app``.
app: App
#: Toga app in a process, this is available as a class property via
#: ``toga.App.app``. If no app has been created yet, this is set to ``None``.
app: App | None = None
_impl: Any
_camera: Camera
_location: Location
Expand Down

0 comments on commit 261e356

Please sign in to comment.