Skip to content

Commit

Permalink
Further simplify start tracking error setup
Browse files Browse the repository at this point in the history
xfail directly in the probe rather than awkwardly relying on truthy response from the method
  • Loading branch information
sarayourfriend committed Dec 11, 2024
1 parent 9e3b1d6 commit 1ba7515
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 15 deletions.
3 changes: 1 addition & 2 deletions android/tests_backend/hardware/location.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,4 @@ def setup_location_error(self):
pass

def setup_tracking_start_error(self):
# errors do not occur when tracking starts on Android
pass
pytest.xfail("Tracking start cannot fail on Android")
4 changes: 2 additions & 2 deletions cocoa/tests_backend/hardware/location.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from unittest.mock import Mock, PropertyMock

import pytest
from rubicon.objc import ObjCClass

from toga_cocoa import libs as cocoa
Expand Down Expand Up @@ -179,5 +180,4 @@ def setup_location_error(self):
pass

def setup_tracking_start_error(self):
# errors do not occur when tracking starts on macOS
pass
pytest.xfail("Tracking start cannot fail on macOS")
4 changes: 0 additions & 4 deletions gtk/tests_backend/hardware/location.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,6 @@ def setup_location_error(self):

def setup_tracking_start_error(self):
self.mock_native.client.props.active = False
# Return True to indicate tracking start errors are setup
return True

async def simulate_location_error(self, location):
# No simulation required after setup_location_error, wait for the location
Expand Down Expand Up @@ -201,8 +199,6 @@ def _xfail_location_portal_no_post_init_failure(self):

def setup_tracking_start_error(self):
self._xfail_location_portal_no_post_init_failure()
# Return True to indicate tracking start errors are setup
return True

def setup_location_error(self):
self._xfail_location_portal_no_post_init_failure()
Expand Down
4 changes: 2 additions & 2 deletions iOS/tests_backend/hardware/location.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from unittest.mock import Mock, PropertyMock

import pytest
from rubicon.objc import ObjCClass

from toga_iOS import libs as iOS
Expand Down Expand Up @@ -179,5 +180,4 @@ def setup_location_error(self):
pass

def setup_tracking_start_error(self):
# errors do not occur when tracking starts on iOS
pass
pytest.xfail("Tracking start cannot fail on iOS")
5 changes: 0 additions & 5 deletions testbed/tests/hardware/test_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,6 @@ async def test_location_error(app, location_probe):

async def test_location_tracking_start_error(app, location_probe):
"""If location tracking fails to start, location raises an error."""
if not location_probe.setup_tracking_start_error():
return pytest.xfail(
f"Tracking start cannot fail on {toga.platform.current_platform}"
)

# Ensure location has permissions
location_probe.grant_permission()

Expand Down

0 comments on commit 1ba7515

Please sign in to comment.