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

silx.gui: improved qWidgetFactory test fixture #4009

Merged
merged 2 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/silx/gui/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import weakref
import pytest

from silx.gui import qt
Expand Down Expand Up @@ -27,7 +26,7 @@ def createWidget(cls, *args, **kwargs):
qapp_utils.qWaitForWindowExposed(widget)
widgets.append(widget)

return weakref.proxy(widget)
return widget

yield createWidget

Expand Down
19 changes: 9 additions & 10 deletions src/silx/gui/widgets/test/test_floatedit.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,20 @@

@pytest.fixture
def floatEdit(qWidgetFactory):
proxy = qWidgetFactory(FloatEdit)
yield proxy
widget = qWidgetFactory(FloatEdit)
yield widget


@pytest.fixture
def floatEditHolder(qapp, qapp_utils, qWidgetFactory, floatEdit):
proxy = qWidgetFactory(qt.QWidget)
holder = proxy.__repr__.__self__
layout = qt.QHBoxLayout(holder)
def floatEditHolder(qWidgetFactory, floatEdit):
widget = qWidgetFactory(qt.QWidget)
layout = qt.QHBoxLayout(widget)
layout.addStretch()
layout.addWidget(floatEdit.__repr__.__self__)
yield proxy
layout.addWidget(floatEdit)
yield widget


def test_show(qapp_utils, floatEdit):
def test_show(floatEdit):
pass


Expand All @@ -55,7 +54,7 @@ def test_value(floatEdit):
assert floatEdit.value() == 1.5


def test_no_widgetresize(qapp_utils, floatEditHolder, floatEdit):
def test_no_widgetresize(floatEditHolder, floatEdit):
floatEditHolder.resize(50, 50)
floatEdit.setValue(123)
a = floatEdit.width()
Expand Down