def test_schema_section_missing(self): """Test that an error is returned if the schema section is missing from the input file. """ self._config.remove_section(DESCRIPTION_SECTION) with self.assertRaises(RuntimeError): get_cfg_schema_version(self._config)
def test_schema_version_not_int(self): """Test that a externals description file a version that doesn't decompose to integer major, minor and patch versions raises runtime error. """ self._config.set(DESCRIPTION_SECTION, VERSION_ITEM, 'unknown') with self.assertRaises(RuntimeError): get_cfg_schema_version(self._config)
def test_schema_version_missing(self): """Test that a externals description file without a version raises a runtime error. """ # Note: the default setup method shouldn't include a version # keyword, but remove it just to be future proof.... self._config.remove_option(DESCRIPTION_SECTION, VERSION_ITEM) with self.assertRaises(RuntimeError): get_cfg_schema_version(self._config)
def test_schema_version_valid(self): """Test that schema identification returns the correct version for a valid tag. """ version_str = '2.1.3' self._config.set(DESCRIPTION_SECTION, VERSION_ITEM, version_str) major, minor, patch = get_cfg_schema_version(self._config) expected_major = 2 expected_minor = 1 expected_patch = 3 self.assertEqual(expected_major, major) self.assertEqual(expected_minor, minor) self.assertEqual(expected_patch, patch)