conftest.py 1.1 KB

1234567891011121314151617181920212223242526
  1. # Copyright (c) 2018 Ultimaker B.V.
  2. # Cura is released under the terms of the LGPLv3 or higher.
  3. # The purpose of this class is to create fixtures or methods that can be shared among all tests.
  4. import unittest.mock
  5. import pytest
  6. import Arcus #Prevents error: "PyCapsule_GetPointer called with incorrect name" with conflicting SIP configurations between Arcus and PyQt: Import Arcus and Savitar first!
  7. import Savitar
  8. from UM.Qt.QtApplication import QtApplication #QtApplication import is required, even though it isn't used.
  9. from cura.CuraApplication import CuraApplication
  10. from cura.MachineActionManager import MachineActionManager
  11. # Create a CuraApplication object that will be shared among all tests. It needs to be initialized.
  12. # Since we need to use it more that once, we create the application the first time and use its instance afterwards.
  13. @pytest.fixture()
  14. def application() -> CuraApplication:
  15. app = unittest.mock.MagicMock()
  16. return app
  17. # Returns a MachineActionManager instance.
  18. @pytest.fixture()
  19. def machine_action_manager(application) -> MachineActionManager:
  20. return MachineActionManager(application)