Skip to content

Commit

Permalink
add xfails for existing leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
samschott committed Sep 14, 2024
1 parent 498b783 commit 6df10ab
Show file tree
Hide file tree
Showing 21 changed files with 59 additions and 9 deletions.
8 changes: 4 additions & 4 deletions testbed/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@

# Use this for widgets or tests which are not supported on some platforms, but could be
# supported in the future.
def skip_on_platforms(*platforms):
def skip_on_platforms(*platforms, reason=None):
current_platform = toga.platform.current_platform
if current_platform in platforms:
skip(f"not yet implemented on {current_platform}")
skip(reason or f"not yet implemented on {current_platform}")


# Use this for widgets or tests which are not supported on some platforms, and will not
# be supported in the foreseeable future.
def xfail_on_platforms(*platforms):
def xfail_on_platforms(*platforms, reason=None):
current_platform = toga.platform.current_platform
if current_platform in platforms:
skip(f"not applicable on {current_platform}")
skip(reason or f"not applicable on {current_platform}")


@fixture(autouse=True)
Expand Down
3 changes: 3 additions & 0 deletions testbed/tests/widgets/test_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import toga
from toga.style import Pack

from ..conftest import xfail_on_platforms
from .properties import ( # noqa: F401
test_background_color,
test_background_color_reset,
Expand All @@ -21,6 +22,8 @@ async def widget():


async def test_cleanup():
xfail_on_platforms("iOS", reason="Leaks memory")

widget = toga.Box(style=Pack(width=100, height=200))
ref = weakref.ref(widget)

Expand Down
3 changes: 3 additions & 0 deletions testbed/tests/widgets/test_button.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from toga.colors import TRANSPARENT

from ..assertions import assert_color
from ..conftest import xfail_on_platforms
from ..data import TEXTS
from .properties import ( # noqa: F401
test_background_color,
Expand All @@ -34,6 +35,8 @@ async def widget():


async def test_cleanup():
xfail_on_platforms("android", reason="Leaks memory")

widget = toga.Button("Hello")
ref = weakref.ref(widget)

Expand Down
3 changes: 3 additions & 0 deletions testbed/tests/widgets/test_canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from toga.fonts import BOLD
from toga.style.pack import SYSTEM, Pack

from ..conftest import xfail_on_platforms
from .properties import ( # noqa: F401
test_background_color,
test_background_color_reset,
Expand Down Expand Up @@ -111,6 +112,8 @@ def assert_pixel(image, x, y, color):


async def test_cleanup():
xfail_on_platforms("android", reason="Leaks memory")

widget = toga.Canvas()
ref = weakref.ref(widget)

Expand Down
3 changes: 2 additions & 1 deletion testbed/tests/widgets/test_dateinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import toga

from ..conftest import skip_on_platforms
from ..conftest import skip_on_platforms, xfail_on_platforms
from .properties import ( # noqa: F401
test_background_color,
test_background_color_reset,
Expand Down Expand Up @@ -86,6 +86,7 @@ async def widget():

async def test_cleanup():
skip_on_platforms("macOS", "iOS", "linux")
xfail_on_platforms("android", reason="Leaks memory")

widget = toga.DateInput()
ref = weakref.ref(widget)
Expand Down
3 changes: 3 additions & 0 deletions testbed/tests/widgets/test_detailedlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from toga.sources import ListSource
from toga.style.pack import Pack

from ..conftest import xfail_on_platforms
from .properties import ( # noqa: F401
test_enable_noop,
test_flex_widget_size,
Expand Down Expand Up @@ -77,6 +78,8 @@ async def widget(


async def test_cleanup():
xfail_on_platforms("android", "linux", reason="Leaks memory")

widget = toga.DetailedList()
ref = weakref.ref(widget)

Expand Down
2 changes: 2 additions & 0 deletions testbed/tests/widgets/test_divider.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from toga.constants import Direction
from toga.style.pack import COLUMN, ROW

from ..conftest import xfail_on_platforms
from .properties import ( # noqa: F401
test_enable_noop,
test_focus_noop,
Expand All @@ -19,6 +20,7 @@ async def widget():


async def test_cleanup():
xfail_on_platforms("iOS", reason="Leaks memory")

widget = toga.Divider()
ref = weakref.ref(widget)
Expand Down
3 changes: 3 additions & 0 deletions testbed/tests/widgets/test_mapview.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import toga
from toga.style import Pack

from ..conftest import xfail_on_platforms
from .properties import ( # noqa: F401
test_flex_widget_size,
)
Expand Down Expand Up @@ -60,6 +61,8 @@ async def widget(on_select):


async def test_cleanup():
xfail_on_platforms("android", reason="Leaks memory")

widget = toga.MapView()
ref = weakref.ref(widget)

Expand Down
3 changes: 3 additions & 0 deletions testbed/tests/widgets/test_multilinetextinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import toga
from toga.style import Pack

from ..conftest import xfail_on_platforms
from .properties import ( # noqa: F401
test_alignment,
test_background_color,
Expand Down Expand Up @@ -46,6 +47,8 @@ def verify_font_sizes():


async def test_cleanup():
xfail_on_platforms("android", "linux", reason="Leaks memory")

widget = toga.MultilineTextInput(value="Hello")
ref = weakref.ref(widget)

Expand Down
4 changes: 3 additions & 1 deletion testbed/tests/widgets/test_numberinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import toga

from ..conftest import skip_on_platforms
from ..conftest import skip_on_platforms, xfail_on_platforms
from .properties import ( # noqa: F401
test_alignment,
test_background_color,
Expand Down Expand Up @@ -44,6 +44,8 @@ def verify_focus_handlers():


async def test_cleanup():
xfail_on_platforms("android", reason="Leaks memory")

widget = toga.NumberInput(value="1.23", step="0.01")
ref = weakref.ref(widget)

Expand Down
3 changes: 3 additions & 0 deletions testbed/tests/widgets/test_optioncontainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from toga.colors import CORNFLOWERBLUE, GOLDENROD, REBECCAPURPLE, SEAGREEN
from toga.style.pack import Pack

from ..conftest import xfail_on_platforms
from .probe import get_probe
from .properties import ( # noqa: F401
test_enable_noop,
Expand Down Expand Up @@ -74,6 +75,8 @@ async def widget(content1, content2, content3, on_select_handler):


async def test_cleanup():
xfail_on_platforms("android", "iOS", "linux", reason="Leaks memory")

widget = toga.OptionContainer(content=[("Tab 1", toga.Box())])
ref = weakref.ref(widget)

Expand Down
3 changes: 3 additions & 0 deletions testbed/tests/widgets/test_passwordinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import toga

from ..conftest import xfail_on_platforms
from .properties import ( # noqa: F401
test_alignment,
test_background_color,
Expand Down Expand Up @@ -48,6 +49,8 @@ def verify_font_sizes():


async def test_cleanup():
xfail_on_platforms("android", reason="Leaks memory")

widget = toga.PasswordInput(value="sekrit")
ref = weakref.ref(widget)

Expand Down
3 changes: 3 additions & 0 deletions testbed/tests/widgets/test_scrollcontainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from toga.colors import CORNFLOWERBLUE, REBECCAPURPLE, TRANSPARENT
from toga.style.pack import COLUMN, ROW, Pack

from ..conftest import xfail_on_platforms
from .properties import ( # noqa: F401
test_background_color,
test_background_color_reset,
Expand Down Expand Up @@ -75,6 +76,8 @@ async def widget(content, on_scroll):


async def test_cleanup():
xfail_on_platforms("android", "iOS", "linux", reason="Leaks memory")

widget = toga.ScrollContainer(content=toga.Box())
ref = weakref.ref(widget)

Expand Down
3 changes: 3 additions & 0 deletions testbed/tests/widgets/test_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from toga.constants import CENTER
from toga.sources import ListSource

from ..conftest import xfail_on_platforms
from .properties import ( # noqa: F401
test_alignment,
test_background_color,
Expand Down Expand Up @@ -54,6 +55,8 @@ def verify_vertical_alignment():


async def test_cleanup():
xfail_on_platforms("android", "iOS", "windows", reason="Leaks memory")

widget = toga.Selection(items=["first", "second", "third"])
ref = weakref.ref(widget)

Expand Down
3 changes: 3 additions & 0 deletions testbed/tests/widgets/test_slider.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import toga

from ..assertions import assert_set_get
from ..conftest import xfail_on_platforms
from .properties import ( # noqa: F401
test_enabled,
test_flex_horizontal_widget_size,
Expand Down Expand Up @@ -44,6 +45,8 @@ def on_change(widget):


async def test_cleanup():
xfail_on_platforms("android", reason="Leaks memory")

widget = toga.Slider()
ref = weakref.ref(widget)

Expand Down
3 changes: 3 additions & 0 deletions testbed/tests/widgets/test_switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import toga

from ..conftest import xfail_on_platforms
from ..data import TEXTS
from .properties import ( # noqa: F401
test_color,
Expand All @@ -30,6 +31,8 @@ async def widget():


async def test_cleanup():
xfail_on_platforms("android", "iOS", "linux", reason="Leaks memory")

widget = toga.Switch("Hello")
ref = weakref.ref(widget)

Expand Down
3 changes: 2 additions & 1 deletion testbed/tests/widgets/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from toga.sources import ListSource
from toga.style.pack import Pack

from ..conftest import skip_on_platforms
from ..conftest import skip_on_platforms, xfail_on_platforms
from .probe import get_probe
from .properties import ( # noqa: F401
test_background_color,
Expand Down Expand Up @@ -115,6 +115,7 @@ async def multiselect_probe(main_window, multiselect_widget):

async def test_cleanup():
skip_on_platforms("iOS")
xfail_on_platforms("linux", reason="Leaks memory")

widget = toga.Table(headings=["A", "B", "C"])
ref = weakref.ref(widget)
Expand Down
3 changes: 3 additions & 0 deletions testbed/tests/widgets/test_textinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import toga
from toga.constants import CENTER

from ..conftest import xfail_on_platforms
from ..data import TEXTS
from .properties import ( # noqa: F401
test_alignment,
Expand Down Expand Up @@ -54,6 +55,8 @@ async def placeholder(request, widget):


async def test_cleanup():
xfail_on_platforms("android", reason="Leaks memory")

widget = toga.TextInput(value="Hello")
ref = weakref.ref(widget)

Expand Down
3 changes: 2 additions & 1 deletion testbed/tests/widgets/test_timeinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import toga

from ..conftest import skip_on_platforms
from ..conftest import skip_on_platforms, xfail_on_platforms
from .properties import ( # noqa: F401
test_background_color,
test_background_color_reset,
Expand Down Expand Up @@ -81,6 +81,7 @@ async def widget():


async def test_cleanup():
xfail_on_platforms("android", reason="Leaks memory")
skip_on_platforms("macOS", "iOS", "linux")

widget = toga.TimeInput()
Expand Down
3 changes: 2 additions & 1 deletion testbed/tests/widgets/test_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from toga.sources import TreeSource
from toga.style.pack import Pack

from ..conftest import skip_on_platforms
from ..conftest import skip_on_platforms, xfail_on_platforms
from .probe import get_probe
from .properties import ( # noqa: F401
test_background_color,
Expand Down Expand Up @@ -167,6 +167,7 @@ async def multiselect_probe(main_window, multiselect_widget):


async def test_cleanup():
xfail_on_platforms("linux", reason="Leaks memory")
skip_on_platforms("iOS", "android", "windows")

widget = toga.Tree(headings=["A", "B", "C"])
Expand Down
3 changes: 3 additions & 0 deletions testbed/tests/widgets/test_webview.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import toga
from toga.style import Pack

from ..conftest import xfail_on_platforms
from .properties import ( # noqa: F401
test_flex_widget_size,
test_focus,
Expand Down Expand Up @@ -117,6 +118,8 @@ async def widget(on_load):


async def test_cleanup():
xfail_on_platforms("linux", reason="Leaks memory")

widget = toga.WebView()
ref = weakref.ref(widget)

Expand Down

0 comments on commit 6df10ab

Please sign in to comment.