mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-02 08:44:25 +08:00
Add test for the version number being incremented
This commit is contained in:
parent
715eda4f59
commit
b149ef57fd
@ -0,0 +1,34 @@
|
|||||||
|
# Copyright (c) 2018 Ultimaker B.V.
|
||||||
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
|
import configparser #To parse the resulting config files.
|
||||||
|
import pytest #To register tests with.
|
||||||
|
|
||||||
|
import VersionUpgrade34to40 #The module we're testing.
|
||||||
|
|
||||||
|
## Creates an instance of the upgrader to test with.
|
||||||
|
@pytest.fixture
|
||||||
|
def upgrader():
|
||||||
|
return VersionUpgrade34to40.VersionUpgrade34to40()
|
||||||
|
|
||||||
|
test_upgrade_version_nr_data = [
|
||||||
|
("Empty config file",
|
||||||
|
"""[general]
|
||||||
|
version = 5
|
||||||
|
[metadata]
|
||||||
|
setting_version = 4
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
]
|
||||||
|
|
||||||
|
## Tests whether the version numbers are updated.
|
||||||
|
def test_upgradeVersionNr(test_name, file_data, upgrader):
|
||||||
|
#Perform the upgrade.
|
||||||
|
_, upgraded_instances = upgrader.upgradePreferences(file_data, "<string>")
|
||||||
|
upgraded_instance = upgraded_instances[0]
|
||||||
|
parser = configparser.ConfigParser(interpolation = None)
|
||||||
|
parser.read_string(upgraded_instance)
|
||||||
|
|
||||||
|
#Check the new version.
|
||||||
|
assert parser["general"]["version"] == "6"
|
||||||
|
assert parser["metadata"]["setting_version"] == "5"
|
Loading…
x
Reference in New Issue
Block a user