summaryrefslogtreecommitdiff
path: root/morphlib/yamlparse_tests.py
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2013-01-29 13:50:46 +0000
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2013-01-29 14:32:49 +0000
commite06eafcbf0784271f51c0936852d1e97c0ccce8b (patch)
treee7e914cd82348e79b7662e6bd06851a0100e7751 /morphlib/yamlparse_tests.py
parent63f608d7c05095c16d1a8863b13c55634c0cae8b (diff)
downloadmorph-e06eafcbf0784271f51c0936852d1e97c0ccce8b.tar.gz
Make yaml be an optional dependency
This can go away when we have made a release with yaml in it, and its staging filler.
Diffstat (limited to 'morphlib/yamlparse_tests.py')
-rw-r--r--morphlib/yamlparse_tests.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/morphlib/yamlparse_tests.py b/morphlib/yamlparse_tests.py
index cb658e15..f5c2569b 100644
--- a/morphlib/yamlparse_tests.py
+++ b/morphlib/yamlparse_tests.py
@@ -15,17 +15,20 @@
import unittest
-try:
- from collections import OrderedDict
-except ImportError:
- from ordereddict import OrderedDict
-import yaml
-
+import morphlib
import morphlib.yamlparse as yamlparse
+from morphlib.util import OrderedDict
+
+if morphlib.got_yaml:
+ yaml = morphlib.yaml
class YAMLParseTests(unittest.TestCase):
+ def run(self, *args, **kwargs):
+ if morphlib.got_yaml:
+ return unittest.TestCase.run(self, *args, **kwargs)
+
example_text = '''\
name: foo
kind: chunk