Skip to content

Commit

Permalink
editor: tests: Fix object lifetime issue detected with PyQt6
Browse files Browse the repository at this point in the history
Some tests explicitly close the editorstack widget. qtbot also closes
the widget after the test finishes. The latter action may fail when
"delete on close" flag is set => reset the flag.
  • Loading branch information
rear1019 committed Jan 7, 2025
1 parent ddc4d66 commit 6ab0f8c
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

# Third party imports
import pytest
from qtpy.QtCore import Qt

# Local imports
from spyder.config.base import running_in_ci
Expand Down Expand Up @@ -75,6 +76,11 @@ def _create_editorstack(files):
editorstack.save_dialog_on_tests = True
editorstack.set_outlineexplorer(outlineexplorer)

# Some tests explicitly close the editorstack widget. qtbot also
# closes the widget after the test finishes. The latter action
# may fail when "delete on close" flag is set => clear the flag.
editorstack.setAttribute(Qt.WA_DeleteOnClose, False)

qtbot.addWidget(editorstack)
editorstack.show()

Expand Down

0 comments on commit 6ab0f8c

Please sign in to comment.