summaryrefslogtreecommitdiff
path: root/morphlib/morph2_tests.py
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2013-01-18 16:37:17 +0000
committerJavier Jardón <javier.jardon@codethink.co.uk>2013-01-22 18:34:22 +0000
commit3f19b84e03c3452c54f18c1a0ccc6008c6478a99 (patch)
tree290f97fe44fcbe1f29a5c342f46fec7ac46c757f /morphlib/morph2_tests.py
parent7ef9cb8922bd933ae8ee58cb24a2b38844a0e629 (diff)
downloadmorph-3f19b84e03c3452c54f18c1a0ccc6008c6478a99.tar.gz
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.
Diffstat (limited to 'morphlib/morph2_tests.py')
-rw-r--r--morphlib/morph2_tests.py19
1 files changed, 18 insertions, 1 deletions
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('''
{