mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-02 20:52:20 -07:00
Fix global stack tests.
Contributes to CURA-5628.
This commit is contained in:
parent
c8af4f45ce
commit
1364370ede
3 changed files with 50 additions and 111 deletions
|
|
@ -4,16 +4,35 @@
|
|||
# The purpose of this class is to create fixtures or methods that can be shared among all settings tests.
|
||||
|
||||
import pytest
|
||||
import copy
|
||||
|
||||
from UM.Settings.DefinitionContainer import DefinitionContainer #To provide definition containers in the registry fixtures.
|
||||
from UM.Settings.InstanceContainer import InstanceContainer
|
||||
from cura.Settings.CuraContainerRegistry import CuraContainerRegistry
|
||||
from cura.Settings.ExtruderStack import ExtruderStack
|
||||
from cura.Settings.GlobalStack import GlobalStack
|
||||
import cura.Settings.CuraContainerStack
|
||||
|
||||
# Returns the CuraContainerRegistry instance with some empty containers.
|
||||
@pytest.fixture()
|
||||
def container_registry(application):
|
||||
def container_registry(application) -> CuraContainerRegistry:
|
||||
return application.getContainerRegistry()
|
||||
|
||||
# Gives an arbitrary definition container.
|
||||
@pytest.fixture()
|
||||
def definition_container():
|
||||
return DefinitionContainer(container_id = "Test Definition")
|
||||
def definition_container() -> DefinitionContainer:
|
||||
return DefinitionContainer(container_id = "Test Definition")
|
||||
|
||||
#An empty global stack to test with.
|
||||
@pytest.fixture()
|
||||
def global_stack() -> GlobalStack:
|
||||
global_stack = GlobalStack("TestGlobalStack")
|
||||
# There is a restriction here that the definition changes cannot be an empty container. Added in CURA-5281
|
||||
definition_changes_container = InstanceContainer(container_id = "InstanceContainer")
|
||||
definition_changes_container.setMetaDataEntry("type", "definition_changes")
|
||||
global_stack._containers[cura.Settings.CuraContainerStack._ContainerIndexes.DefinitionChanges] = definition_changes_container
|
||||
return global_stack
|
||||
|
||||
## An empty extruder stack to test with.
|
||||
@pytest.fixture()
|
||||
def extruder_stack() -> ExtruderStack:
|
||||
return ExtruderStack("TestExtruderStack")
|
||||
Loading…
Add table
Add a link
Reference in a new issue