mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-11 16:57:51 -06:00
STAR-322: Using a test setup to run tests with Cura app
This commit is contained in:
parent
134f97d5f1
commit
f432d7c858
5 changed files with 58 additions and 17 deletions
37
plugins/UM3NetworkPrinting/tests/conftest.py
Normal file
37
plugins/UM3NetworkPrinting/tests/conftest.py
Normal file
|
@ -0,0 +1,37 @@
|
|||
# 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
|
Loading…
Add table
Add a link
Reference in a new issue