Fix running tests in plugin using pytest

This commit is contained in:
ChrisTerBeke 2018-11-19 13:42:28 +01:00
parent 951a21ead7
commit f8f133d2ef
5 changed files with 28 additions and 19 deletions

View file

@ -1,16 +1,17 @@
# Copyright (c) 2017 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
import configparser
import pytest
import configparser #To check whether the appropriate exceptions are raised.
import pytest #To register tests with.
from plugins.VersionUpgrade.VersionUpgrade25to26 import VersionUpgrade25to26
import VersionUpgrade25to26 #The module we're testing.
## Creates an instance of the upgrader to test with.
@pytest.fixture
def upgrader():
return VersionUpgrade25to26.VersionUpgrade25to26()
test_cfg_version_good_data = [
{
"test_name": "Simple",
@ -60,6 +61,7 @@ setting_version = -3
}
]
## Tests the technique that gets the version number from CFG files.
#
# \param data The parametrised data to test with. It contains a test name
@ -116,6 +118,7 @@ version = 1.2
}
]
## Tests whether getting a version number from bad CFG files gives an
# exception.
#
@ -155,6 +158,7 @@ foo = bar
}
]
## Tests whether the settings that should be removed are removed for the 2.6
# version of preferences.
@pytest.mark.parametrize("data", test_upgrade_preferences_removed_settings_data)
@ -200,6 +204,7 @@ type = instance_container
}
]
## Tests whether the settings that should be removed are removed for the 2.6
# version of instance containers.
@pytest.mark.parametrize("data", test_upgrade_instance_container_removed_settings_data)