Browse Source

Add cleanup test

Silas Gruen 11 tháng trước cách đây
mục cha
commit
99f66d9b63
1 tập tin đã thay đổi với 13 bổ sung0 xóa
  1. 13 0
      robot-control/tests/test_vision.py

+ 13 - 0
robot-control/tests/test_vision.py

@@ -23,3 +23,16 @@ class TestDataMatrixReader:
         result = datamatrix_reader.read_datamatrix() # first is success
         result = datamatrix_reader.read_datamatrix() # second is failure
         assert result is None
+
+    def test_cleanup(self, datamatrix_reader: DataMatrixReader):
+        datamatrix_reader.initialize()
+        datamatrix_reader.cleanup()
+        assert datamatrix_reader.camera is not None
+        
+    def test_cleanup_real_camera(self, datamatrix_reader_realcam: DataMatrixReader):
+        try:
+            datamatrix_reader_realcam.initialize()
+            datamatrix_reader_realcam.cleanup()
+            assert datamatrix_reader_realcam.camera is not None
+        except Exception:
+            pytest.skip("No real camera available for testing")