conftest.py 1012 B

1234567891011121314151617181920212223
  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 pytest
  5. from UM.Qt.QtApplication import QtApplication #QtApplication import is required, even though it isn't used.
  6. from cura.CuraApplication import CuraApplication
  7. from cura.MachineActionManager import MachineActionManager
  8. # Create a CuraApplication object that will be shared among all tests. It needs to be initialized.
  9. # Since we need to use it more that once, we create the application the first time and use its instance afterwards.
  10. @pytest.fixture()
  11. def application() -> CuraApplication:
  12. application = CuraApplication.getInstance()
  13. if application is None:
  14. application = CuraApplication()
  15. return application
  16. # Returns a MachineActionManager instance.
  17. @pytest.fixture()
  18. def machine_action_manager(application) -> MachineActionManager:
  19. return application.getMachineActionManager()