Use python-fastimport.
[jelmer/dulwich-libgit2.git] / dulwich / tests / test_fastexport.py
index 485b1cae1da568ec2a6c814fd3999e9f2c89abeb..f240e4a47e8e91c2b903b703b928ea923e3d8a45 100644 (file)
 
 from cStringIO import StringIO
 import stat
-from unittest import TestCase
 
-from dulwich.fastexport import (
-    FastExporter,
-    )
 from dulwich.object_store import (
     MemoryObjectStore,
     )
@@ -32,20 +28,28 @@ from dulwich.objects import (
     Commit,
     Tree,
     )
+from dulwich.tests import (
+    TestCase,
+    TestSkipped,
+    )
 
 
-class FastExporterTests(TestCase):
+class GitFastExporterTests(TestCase):
 
     def setUp(self):
-        super(FastExporterTests, self).setUp()
+        super(GitFastExporterTests, self).setUp()
         self.store = MemoryObjectStore()
         self.stream = StringIO()
-        self.fastexporter = FastExporter(self.stream, self.store)
+        try:
+            from dulwich.fastexport import GitFastExporter
+        except ImportError:
+            raise TestSkipped("python-fastimport not available")
+        self.fastexporter = GitFastExporter(self.stream, self.store)
 
     def test_export_blob(self):
         b = Blob()
         b.data = "fooBAR"
-        self.assertEquals(1, self.fastexporter.export_blob(b))
+        self.assertEquals('1', self.fastexporter.export_blob(b))
         self.assertEquals('blob\nmark :1\ndata 6\nfooBAR\n',
             self.stream.getvalue())