summaryrefslogtreecommitdiff
path: root/morphlib/morph2_tests.py
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-09-13 15:39:07 +0100
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-09-13 15:39:07 +0100
commit2b82040f847a5595dccb80f8ed537e7d6c5a1e6e (patch)
tree4945051fca5c55c6e8672ad61f0c499916960121 /morphlib/morph2_tests.py
parent90821e1e58317ae105bd2ecf43f46f441e292fcd (diff)
downloadmorph-2b82040f847a5595dccb80f8ed537e7d6c5a1e6e.tar.gz
Fix things so test suite works on Debian squeeze
This requires disabling the feature that retains the original order of fields in a morphlogy when it gets overwritten. The implementation relies on features that are not available in Python 2.6. We need to support Morph on Debian squeeze, for bootstrapping purposes, and therefore need to have it work with Python 2.6. However, the morphology rewriting is only relevant for system branching and merging, and that isn't needed for bootstrapping, so we disable the affected tests on Python 2.6.
Diffstat (limited to 'morphlib/morph2_tests.py')
-rw-r--r--morphlib/morph2_tests.py60
1 files changed, 33 insertions, 27 deletions
diff --git a/morphlib/morph2_tests.py b/morphlib/morph2_tests.py
index 142b5949..baa6f724 100644
--- a/morphlib/morph2_tests.py
+++ b/morphlib/morph2_tests.py
@@ -14,6 +14,9 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+import sys
+have_python27 = sys.version_info >= (2,7)
+
import StringIO
import unittest
@@ -199,8 +202,9 @@ class MorphologyTests(unittest.TestCase):
Morphology,
text)
- def test_writing_preserves_field_order(self):
- text = '''{
+ if have_python27:
+ def test_writing_preserves_field_order(self):
+ text = '''{
"kind": "system",
"disk-size": 1073741824,
"description": "Some text",
@@ -219,18 +223,19 @@ class MorphologyTests(unittest.TestCase):
}
]
}'''
- morphology = Morphology(text)
- output = StringIO.StringIO()
- morphology.write_to_file(output)
+ morphology = Morphology(text)
+ output = StringIO.StringIO()
+ morphology.write_to_file(output)
- text_lines = text.splitlines()
- output_lines = output.getvalue().splitlines()
+ text_lines = text.splitlines()
+ output_lines = output.getvalue().splitlines()
- # Verify that input and output are equal.
- self.assertEqual(text_lines, output_lines)
+ # Verify that input and output are equal.
+ self.assertEqual(text_lines, output_lines)
- def test_writing_stratum_morphology_preserves_chunk_order(self):
- text = '''{
+ if have_python27:
+ def test_writing_stratum_morphology_preserves_chunk_order(self):
+ text = '''{
"kind": "stratum",
"chunks": [
{
@@ -247,29 +252,30 @@ class MorphologyTests(unittest.TestCase):
}
]
}'''
- morphology = Morphology(text)
- output = StringIO.StringIO()
- morphology.write_to_file(output)
+ morphology = Morphology(text)
+ output = StringIO.StringIO()
+ morphology.write_to_file(output)
- text_lines = text.splitlines()
- output_lines = output.getvalue().splitlines()
+ text_lines = text.splitlines()
+ output_lines = output.getvalue().splitlines()
- # Verify that input and output are equal.
- self.assertEqual(text_lines, output_lines)
+ # Verify that input and output are equal.
+ self.assertEqual(text_lines, output_lines)
- def test_writing_preserves_disk_size(self):
- text = '''{
+ if have_python27:
+ def test_writing_preserves_disk_size(self):
+ text = '''{
"kind": "system",
"disk-size": "1g",
"arch": "x86_64",
"system-kind": "syslinux-disk"
}'''
- morphology = Morphology(text)
- output = StringIO.StringIO()
- morphology.write_to_file(output)
+ morphology = Morphology(text)
+ output = StringIO.StringIO()
+ morphology.write_to_file(output)
- text_lines = text.splitlines()
- output_lines = output.getvalue().splitlines()
+ text_lines = text.splitlines()
+ output_lines = output.getvalue().splitlines()
- # Verify that in- and output are the same.
- self.assertEqual(text_lines, output_lines)
+ # Verify that in- and output are the same.
+ self.assertEqual(text_lines, output_lines)