From 3f19b84e03c3452c54f18c1a0ccc6008c6478a99 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Fri, 18 Jan 2013 16:37:17 +0000 Subject: Fix tests Invalid text changed to be something that doesn't parse as YAML either, and catch convert the YAMLError to the expected exception. Ideally there wouldn't be any `#pragma: no cover`s, but I could not trigger these code paths. --- morphlib/morph2_tests.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'morphlib/morph2_tests.py') diff --git a/morphlib/morph2_tests.py b/morphlib/morph2_tests.py index 756873a0..34df4657 100644 --- a/morphlib/morph2_tests.py +++ b/morphlib/morph2_tests.py @@ -22,7 +22,7 @@ from morphlib.morph2 import Morphology class MorphologyTests(unittest.TestCase): - def test_parses_simple_chunk(self): + def test_parses_simple_json_chunk(self): m = Morphology(''' { "name": "foo", @@ -41,6 +41,23 @@ class MorphologyTests(unittest.TestCase): self.assertEqual(m['max-jobs'], None) self.assertEqual(m['chunks'], []) + def test_parses_simple_yaml_chunk(self): + m = Morphology(''' + name: foo + kind: chunk + build-system: manual + ''') + + self.assertEqual(m['name'], 'foo') + self.assertEqual(m['kind'], 'chunk') + self.assertEqual(m['build-system'], 'manual') + self.assertEqual(m['configure-commands'], None) + self.assertEqual(m['build-commands'], None) + self.assertEqual(m['test-commands'], None) + self.assertEqual(m['install-commands'], None) + self.assertEqual(m['max-jobs'], None) + self.assertEqual(m['chunks'], []) + def test_sets_stratum_chunks_repo_and_morph_from_name(self): m = Morphology(''' { -- cgit v1.2.1