diff --git a/tests/test_model.py b/tests/test_model.py deleted file mode 100644 index adefe0d..0000000 --- a/tests/test_model.py +++ /dev/null @@ -1,26 +0,0 @@ -import pytest -from parallax.model import Model - -def test_scan_for_cameras(mocker): - """ - Test the `scan_for_cameras` method in the `Model` class. - - This test ensures that after scanning for cameras, the model correctly detects the number - of available cameras. It uses the `add_mock_cameras` method to simulate camera detection and - then asserts that the correct number of cameras (2) is found. - - Args: - mocker (pytest fixture): The mocker fixture provided by pytest-mock for mocking functions or objects. - """ - # Create an instance of the Model class - model = Model() - - # Call the method under test - model.add_mock_cameras() - model.scan_for_cameras() - - # Check the number of cameras detected - assert model.nPySpinCameras == 2, "The number of cameras should be 2" - - # Clean up - model.clean() \ No newline at end of file diff --git a/tests/test_screen_widget.py b/tests/test_screen_widget.py deleted file mode 100644 index dc2e324..0000000 --- a/tests/test_screen_widget.py +++ /dev/null @@ -1,46 +0,0 @@ -import sys -import pytest -from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QGroupBox -from PyQt5.QtGui import QFont -from unittest.mock import MagicMock -from parallax.screen_widget import ScreenWidget - -@pytest.fixture(scope='session') -def app(): - """Create QApplication before running tests.""" - return QApplication(sys.argv) - -@pytest.fixture -def mock_model(): - """Create a mock model with a list of mock cameras.""" - model = MagicMock() - mock_camera = MagicMock() - model.cameras = [mock_camera] # Assuming at least one mock camera is needed - return model - -def test_screen_widget_with_mock_camera(app, mock_model): - """Test the ScreenWidget with a mock camera.""" - # Create the main window to host the widget - window = QWidget() - layout = QVBoxLayout(window) - - # Create a group box to represent a microscope - microscope_grp = QGroupBox("Mock Microscope", window) - microscope_grp.setFont(QFont("Arial", 9)) - microscope_grp.setStyleSheet("background-color: rgb(58, 58, 58);") - microscope_layout = QVBoxLayout(microscope_grp) - - # Create and add the ScreenWidget to the group box - screen = ScreenWidget(mock_model.cameras[0], model=mock_model, parent=microscope_grp) - microscope_layout.addWidget(screen) - - layout.addWidget(microscope_grp) - window.setLayout(layout) - window.show() - - # This ensures the GUI event loop is running during the test - with pytest.raises(SystemExit): - sys.exit(app.exec_()) - -if __name__ == "__main__": - pytest.main()