Cura/plugins/UM3NetworkPrinting/tests/conftest.py
2018-12-10 13:11:42 +01:00

37 lines
1.2 KiB
Python

# Copyright (c) 2018 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.
import pytest
import Arcus #Prevents error: "PyCapsule_GetPointer called with incorrect name" with conflicting SIP configurations between Arcus and PyQt: Import Arcus first!
from UM.Qt.QtApplication import QtApplication # QT application import is required, even though it isn't used.
from UM.Application import Application
from UM.Signal import Signal
from cura.CuraApplication import CuraApplication
# This mock application must extend from Application and not QtApplication otherwise some QObjects are created and
# a segfault is raised.
class FixtureApplication(CuraApplication):
def __init__(self):
super().__init__()
super().initialize()
Signal._signalQueue = self
def functionEvent(self, event):
event.call()
def parseCommandLine(self):
pass
def processEvents(self):
pass
@pytest.fixture(autouse=True)
def application():
# Since we need to use it more that once, we create the application the first time and use its instance the second
application = FixtureApplication.getInstance()
if application is None:
application = FixtureApplication()
return application