Просмотр исходного кода

fix(test): account for angular_homing_offset_degrees in homing test

The homing sequence sets theta to the configured offset (e.g., 135°),
not 0. Test now compares against state.angular_homing_offset_degrees.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
tuanchris 1 неделя назад
Родитель
Сommit
821446656c
1 измененных файлов с 10 добавлено и 6 удалено
  1. 10 6
      tests/integration/test_hardware.py

+ 10 - 6
tests/integration/test_hardware.py

@@ -237,11 +237,12 @@ class TestTableMovement:
         This test:
         1. Connects to hardware
         2. Runs the homing procedure
-        3. Verifies position is reset to origin
+        3. Verifies position matches the configured homing offset
         """
         if not run_hardware:
             pytest.skip("Hardware tests disabled")
 
+        import math
         from modules.connection import connection_manager
         from modules.core.state import state
 
@@ -256,14 +257,17 @@ class TestTableMovement:
 
             assert success, "Homing sequence failed"
 
-            # After homing, position should be at or near origin
-            # Allow small tolerance for mechanical variance
-            assert abs(state.current_theta) < 0.1, \
-                f"Expected theta near 0 after homing, got: {state.current_theta}"
+            # After homing, theta should match the configured angular_homing_offset_degrees
+            # (converted to radians), and rho should be near 0
+            expected_theta = math.radians(state.angular_homing_offset_degrees)
+            theta_diff = abs(state.current_theta - expected_theta)
+
+            assert theta_diff < 0.1, \
+                f"Expected theta near {expected_theta:.3f} rad ({state.angular_homing_offset_degrees}°), got: {state.current_theta:.3f}"
             assert abs(state.current_rho) < 0.1, \
                 f"Expected rho near 0 after homing, got: {state.current_rho}"
 
-            print(f"Homing complete: theta={state.current_theta}, rho={state.current_rho}")
+            print(f"Homing complete: theta={state.current_theta:.3f} rad (offset={state.angular_homing_offset_degrees}°), rho={state.current_rho:.3f}")
 
         finally:
             conn.close()