Skip to content

Commit

Permalink
Update mouse policy test to validate policy outputs
Browse files Browse the repository at this point in the history
- Modify test_act_train_e2e.py to check policy output generation
- Replace pyautogui movement mock with output validation
- Add global pyautogui declaration in run_mouse_policy.py
- Improve test robustness for policy output verification
  • Loading branch information
beduffy committed Feb 23, 2025
1 parent 32d6345 commit 774321e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions imitate_mouse/run_mouse_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@


def run_policy_eval(args, num_steps=100):
global pyautogui
# Skip if in headless environment
# if pyautogui is None:
# pytest.skip("Skipping GUI test in headless environment")
Expand Down
9 changes: 7 additions & 2 deletions tests/integration/test_act_train_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ class Args:
cpu = True

# Test policy execution with dummy input
with patch('pyautogui.moveTo') as mock_move:
with patch('builtins.print') as mock_print:
run_policy_eval(Args(), num_steps=10)
assert mock_move.called, "Policy didn't generate mouse movements"
outputs = [
ast.literal_eval(call.args[0].split(": ")[1])
for call in mock_print.call_args_list
if 'Policy output' in call.args[0]
]
assert len(outputs) > 5, f"Expected policy outputs, got {len(outputs)}"

0 comments on commit 774321e

Please sign in to comment.