fix: stochastic failure in test_autonomous_goals.py
This commit is contained in:
@@ -344,30 +344,30 @@ class TestActionMasking:
|
||||
|
||||
def test_action_masked_after_max_retries(self):
|
||||
"""After 2 failures, the action must be excluded from available_actions."""
|
||||
action_failures = {"tap reels tab": 2}
|
||||
action_failures = {(ScreenType.HOME_FEED, "tap reels tab"): 2}
|
||||
original_actions = ["tap home tab", "tap reels tab", "tap profile tab"]
|
||||
MAX_RETRIES = 2
|
||||
|
||||
masked = [a for a in original_actions if action_failures.get(a, 0) < MAX_RETRIES]
|
||||
masked = [a for a in original_actions if action_failures.get((ScreenType.HOME_FEED, a), 0) < MAX_RETRIES]
|
||||
assert "tap reels tab" not in masked
|
||||
assert "tap home tab" in masked
|
||||
assert "tap profile tab" in masked
|
||||
|
||||
def test_action_not_masked_under_threshold(self):
|
||||
"""1 failure is not enough to mask."""
|
||||
action_failures = {"tap reels tab": 1}
|
||||
action_failures = {(ScreenType.HOME_FEED, "tap reels tab"): 1}
|
||||
original_actions = ["tap reels tab", "tap profile tab"]
|
||||
MAX_RETRIES = 2
|
||||
|
||||
masked = [a for a in original_actions if action_failures.get(a, 0) < MAX_RETRIES]
|
||||
masked = [a for a in original_actions if action_failures.get((ScreenType.HOME_FEED, a), 0) < MAX_RETRIES]
|
||||
assert "tap reels tab" in masked
|
||||
|
||||
def test_success_resets_failure_count(self):
|
||||
"""A successful execution must reset the failure counter."""
|
||||
action_failures = {"tap reels tab": 1}
|
||||
action_failures = {(ScreenType.HOME_FEED, "tap reels tab"): 1}
|
||||
# Simulate success
|
||||
action_failures["tap reels tab"] = 0
|
||||
assert action_failures["tap reels tab"] == 0
|
||||
action_failures[(ScreenType.HOME_FEED, "tap reels tab")] = 0
|
||||
assert action_failures[(ScreenType.HOME_FEED, "tap reels tab")] == 0
|
||||
|
||||
def test_hd_map_unreachable_with_masked_actions(self):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user