diff --git a/tests/tools/svm/svm_calculator_test.py b/tests/tools/svm/svm_calculator_test.py index 8eb2c52..22bc436 100644 --- a/tests/tools/svm/svm_calculator_test.py +++ b/tests/tools/svm/svm_calculator_test.py @@ -308,20 +308,26 @@ def fake_wait_key(_delay): return 0 return 27 - with patch("fezrs.tools.svm.svm_calculator.cv2.namedWindow"): - with patch( - "fezrs.tools.svm.svm_calculator.cv2.setMouseCallback", - fake_set_mouse_callback, - ): - with patch("fezrs.tools.svm.svm_calculator.cv2.imshow"): - with patch( - "fezrs.tools.svm.svm_calculator.cv2.waitKey", - fake_wait_key, - ): + # The GUI is fully mocked here, so the display check must be forced on: + # otherwise these tests pass on a workstation and fail on headless CI. + with patch( + "fezrs.tools.svm.svm_calculator.display_is_available", + return_value=True, + ): + with patch("fezrs.tools.svm.svm_calculator.cv2.namedWindow"): + with patch( + "fezrs.tools.svm.svm_calculator.cv2.setMouseCallback", + fake_set_mouse_callback, + ): + with patch("fezrs.tools.svm.svm_calculator.cv2.imshow"): with patch( - "fezrs.tools.svm.svm_calculator.cv2.destroyAllWindows" + "fezrs.tools.svm.svm_calculator.cv2.waitKey", + fake_wait_key, ): - calculator.process() + with patch( + "fezrs.tools.svm.svm_calculator.cv2.destroyAllWindows" + ): + calculator.process() def test_nonsquare_training_samples_use_opencv_xy_as_numpy_yx():