mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-14 02:07:51 -06:00
Fix some test in the CuraContainerRegistry.
Delete a test that needs a ContainerProvider. We need to discuss if we want to add it back, depending if we are still keeping the providers. Contributes to CURA-5628.
This commit is contained in:
parent
b85950b128
commit
77c5a94db2
23 changed files with 36 additions and 231 deletions
|
@ -5,6 +5,8 @@
|
|||
|
||||
import pytest
|
||||
|
||||
from UM.Settings.ContainerRegistry import ContainerRegistry
|
||||
from UM.Settings.ContainerStack import setContainerRegistry
|
||||
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
|
||||
|
@ -15,29 +17,38 @@ import cura.Settings.CuraContainerStack
|
|||
# Returns the CuraContainerRegistry instance with some empty containers.
|
||||
@pytest.fixture()
|
||||
def container_registry(application) -> CuraContainerRegistry:
|
||||
return application.getContainerRegistry()
|
||||
ContainerRegistry._ContainerRegistry__instance= None # Need to reset since we only allow one instance
|
||||
registry = CuraContainerRegistry(application)
|
||||
setContainerRegistry(registry)
|
||||
return registry
|
||||
|
||||
# Gives an arbitrary definition container.
|
||||
@pytest.fixture()
|
||||
def definition_container() -> DefinitionContainer:
|
||||
return DefinitionContainer(container_id = "Test Definition")
|
||||
|
||||
#An empty global stack to test with.
|
||||
# Gives an arbitrary definition changes container.
|
||||
@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")
|
||||
def definition_changes_container() -> InstanceContainer:
|
||||
definition_changes_container = InstanceContainer(container_id = "Test Definition Changes")
|
||||
definition_changes_container.setMetaDataEntry("type", "definition_changes")
|
||||
# Add current setting version to the instance container
|
||||
from cura.CuraApplication import CuraApplication
|
||||
definition_changes_container.getMetaData()["setting_version"] = CuraApplication.SettingVersion
|
||||
return definition_changes_container
|
||||
|
||||
# An empty global stack to test with.
|
||||
# There is a restriction here that the definition changes cannot be an empty container. Added in CURA-5281
|
||||
@pytest.fixture()
|
||||
def global_stack(definition_changes_container) -> GlobalStack:
|
||||
global_stack = GlobalStack("TestGlobalStack")
|
||||
global_stack._containers[cura.Settings.CuraContainerStack._ContainerIndexes.DefinitionChanges] = definition_changes_container
|
||||
return global_stack
|
||||
|
||||
## An empty extruder stack to test with.
|
||||
# An empty extruder stack to test with.
|
||||
# There is a restriction here that the definition changes cannot be an empty container. Added in CURA-5281
|
||||
@pytest.fixture()
|
||||
def extruder_stack() -> ExtruderStack:
|
||||
def extruder_stack(definition_changes_container) -> ExtruderStack:
|
||||
extruder_stack= ExtruderStack("TestExtruderStack")
|
||||
# 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")
|
||||
extruder_stack._containers[cura.Settings.CuraContainerStack._ContainerIndexes.DefinitionChanges] = definition_changes_container
|
||||
return extruder_stack
|
Loading…
Add table
Add a link
Reference in a new issue