#!/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)
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)
def testFilesField(self):
self.assertInvalid((1, 7), field='notfiles')
self.assertValid((1, 8), field='notfiles')
+
+if __name__ == '__main__':
+ unittest.main()
#!/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):
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):
#!/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)
'native_tar': 1,
})
-class FormatFromStringTestCase(unittest.TestCase):
+class FormatFromStringTestCase(DakTestCase):
def assertFormat(self, txt, klass):
self.assertEqual(srcformats.get_format_from_string(txt), klass)