From 174b58374aeb6f7d1205d20799c7b1c2a7dfa133 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 28 Apr 2020 10:23:36 +0200 Subject: [PATCH] Remove unneeded unit tests The code was moved to uranium, so no need to test them in a plugin. In some cases they were also testing a specific implementation artifact and not actual expected behavior. CURA-7388 --- .../tests/TestVersionUpgrade25to26.py | 68 ------------------ .../tests/TestVersionUpgrade26to27.py | 72 ------------------- 2 files changed, 140 deletions(-) diff --git a/plugins/VersionUpgrade/VersionUpgrade25to26/tests/TestVersionUpgrade25to26.py b/plugins/VersionUpgrade/VersionUpgrade25to26/tests/TestVersionUpgrade25to26.py index 45cdaebe87..0c5b983b14 100644 --- a/plugins/VersionUpgrade/VersionUpgrade25to26/tests/TestVersionUpgrade25to26.py +++ b/plugins/VersionUpgrade/VersionUpgrade25to26/tests/TestVersionUpgrade25to26.py @@ -63,74 +63,6 @@ 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 -# to debug with, the serialised contents of a CFG file and the correct -# version number in that CFG file. -# \param upgrader The instance of the upgrade class to test. -@pytest.mark.parametrize("data", test_cfg_version_good_data) -def test_cfgVersionGood(data, upgrader): - version = upgrader.getCfgVersion(data["file_data"]) - assert version == data["version"] - -test_cfg_version_bad_data = [ - { - "test_name": "Empty", - "file_data": "", - "exception": configparser.Error #Explicitly not specified further which specific error we're getting, because that depends on the implementation of configparser. - }, - { - "test_name": "No General", - "file_data": """[values] -layer_height = 0.1337 -""", - "exception": configparser.Error - }, - { - "test_name": "No Version", - "file_data": """[general] -true = false -""", - "exception": configparser.Error - }, - { - "test_name": "Not a Number", - "file_data": """[general] -version = not-a-text-version-number -""", - "exception": ValueError - }, - { - "test_name": "Setting Value NaN", - "file_data": """[general] -version = 4 -[metadata] -setting_version = latest_or_something -""", - "exception": ValueError - }, - { - "test_name": "Major-Minor", - "file_data": """[general] -version = 1.2 -""", - "exception": ValueError - } -] - -## Tests whether getting a version number from bad CFG files gives an -# exception. -# -# \param data The parametrised data to test with. It contains a test name -# to debug with, the serialised contents of a CFG file and the class of -# exception it needs to throw. -# \param upgrader The instance of the upgrader to test. -@pytest.mark.parametrize("data", test_cfg_version_bad_data) -def test_cfgVersionBad(data, upgrader): - with pytest.raises(data["exception"]): - upgrader.getCfgVersion(data["file_data"]) - test_upgrade_preferences_removed_settings_data = [ { "test_name": "Removed Setting", diff --git a/plugins/VersionUpgrade/VersionUpgrade26to27/tests/TestVersionUpgrade26to27.py b/plugins/VersionUpgrade/VersionUpgrade26to27/tests/TestVersionUpgrade26to27.py index 6235578238..1465df01e7 100644 --- a/plugins/VersionUpgrade/VersionUpgrade26to27/tests/TestVersionUpgrade26to27.py +++ b/plugins/VersionUpgrade/VersionUpgrade26to27/tests/TestVersionUpgrade26to27.py @@ -35,13 +35,6 @@ infill_sparse_density = 42 """, "version": 3000000 }, - { - "test_name": "Negative Version", #Why not? - "file_data": """[general] -version = -20 -""", - "version": -20000000 - }, { "test_name": "Setting Version", "file_data": """[general] @@ -50,15 +43,6 @@ version = 1 setting_version = 1 """, "version": 1000001 - }, - { - "test_name": "Negative Setting Version", - "file_data": """[general] -version = 1 -[metadata] -setting_version = -3 -""", - "version": 999997 } ] @@ -73,62 +57,6 @@ def test_cfgVersionGood(data, upgrader): version = upgrader.getCfgVersion(data["file_data"]) assert version == data["version"] -test_cfg_version_bad_data = [ - { - "test_name": "Empty", - "file_data": "", - "exception": configparser.Error #Explicitly not specified further which specific error we're getting, because that depends on the implementation of configparser. - }, - { - "test_name": "No General", - "file_data": """[values] -layer_height = 0.1337 -""", - "exception": configparser.Error - }, - { - "test_name": "No Version", - "file_data": """[general] -true = false -""", - "exception": configparser.Error - }, - { - "test_name": "Not a Number", - "file_data": """[general] -version = not-a-text-version-number -""", - "exception": ValueError - }, - { - "test_name": "Setting Value NaN", - "file_data": """[general] -version = 4 -[metadata] -setting_version = latest_or_something -""", - "exception": ValueError - }, - { - "test_name": "Major-Minor", - "file_data": """[general] -version = 1.2 -""", - "exception": ValueError - } -] - -## Tests whether getting a version number from bad CFG files gives an -# exception. -# -# \param data The parametrised data to test with. It contains a test name -# to debug with, the serialised contents of a CFG file and the class of -# exception it needs to throw. -# \param upgrader The instance of the upgrader to test. -@pytest.mark.parametrize("data", test_cfg_version_bad_data) -def test_cfgVersionBad(data, upgrader): - with pytest.raises(data["exception"]): - upgrader.getCfgVersion(data["file_data"]) test_upgrade_stacks_with_not_supported_data = [ {