]> git.decadent.org.uk Git - dak.git/commitdiff
Make all tests use DakTestCase.
authorChris Lamb <lamby@debian.org>
Fri, 30 Oct 2009 23:50:43 +0000 (23:50 +0000)
committerChris Lamb <lamby@debian.org>
Sat, 31 Oct 2009 23:00:12 +0000 (23:00 +0000)
Signed-off-by: Chris Lamb <lamby@debian.org>
tests/test_formats.py
tests/test_regexes.py
tests/test_srcformats.py

index 1ae6860aa60659ba890e9f00c31b1c02a9945ac9..a897eeb0b7df98a92b0c7b9acde9039363cd2fba 100755 (executable)
@@ -1,14 +1,13 @@
 #!/usr/bin/env python
 
-import unittest
+from base_test import DakTestCase
 
-import os, sys
-sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+import unittest
 
 from daklib.formats import parse_format, validate_changes_format
 from daklib.dak_exceptions import UnknownFormatError
 
-class ParseFormatTestCase(unittest.TestCase):
+class ParseFormatTestCase(DakTestCase):
     def assertParse(self, format, expected):
         self.assertEqual(parse_format(format), expected)
 
@@ -30,7 +29,7 @@ class ParseFormatTestCase(unittest.TestCase):
         self.assertParse('1.2 (three)', (1, 2, 'three'))
         self.assertParseFail('0.0 ()')
 
-class ValidateChangesFormat(unittest.TestCase):
+class ValidateChangesFormat(DakTestCase):
     def assertValid(self, changes, field='files'):
         validate_changes_format(changes, field)
 
@@ -56,3 +55,6 @@ class ValidateChangesFormat(unittest.TestCase):
     def testFilesField(self):
         self.assertInvalid((1, 7), field='notfiles')
         self.assertValid((1, 8), field='notfiles')
+
+if __name__ == '__main__':
+    unittest.main()
index 766e73e49070a86fe798498aee38d9d9d29669dd..8faf9a0aaf9ef85e082d6fa79d39fcb7256b2e45 100755 (executable)
@@ -1,13 +1,10 @@
 #!/usr/bin/env python
 
-import unittest
-
-import os, sys
-sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from base_test import DakTestCase
 
 from daklib import regexes
 
-class re_single_line_field(unittest.TestCase):
+class re_single_line_field(DakTestCase):
     MATCH = regexes.re_single_line_field.match
 
     def testSimple(self):
@@ -32,7 +29,7 @@ class re_single_line_field(unittest.TestCase):
         self.assertEqual(self.MATCH('Foo::bar').groups(), ('Foo', ':bar'))
         self.assertEqual(self.MATCH('Foo: :bar').groups(), ('Foo', ':bar'))
 
-class re_parse_lintian(unittest.TestCase):
+class re_parse_lintian(DakTestCase):
     MATCH = regexes.re_parse_lintian.match
 
     def testBinary(self):
index 4ecaf8b7fcc83925238f2473ed7961714158eee2..fa6f3b386c34aa3706d62b359f2755dc31ca70c1 100755 (executable)
@@ -1,17 +1,13 @@
 #!/usr/bin/env python
 
-import unittest
-
-import os, sys
-sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-
-from collections import defaultdict
+from base_test import DakTestCase
 
 from daklib import srcformats
+from collections import defaultdict
 from daklib.formats import parse_format
 from daklib.dak_exceptions import UnknownFormatError
 
-class SourceFormatTestCase(unittest.TestCase):
+class SourceFormatTestCase(DakTestCase):
     def get_rejects(self, has_vars):
         has = defaultdict(lambda: 0)
         has.update(has_vars)
@@ -104,7 +100,7 @@ class FormatTreeQuiltTestCase(SourceFormatTestCase):
             'native_tar': 1,
         })
 
-class FormatFromStringTestCase(unittest.TestCase):
+class FormatFromStringTestCase(DakTestCase):
     def assertFormat(self, txt, klass):
         self.assertEqual(srcformats.get_format_from_string(txt), klass)