File: __init__.py

package info (click to toggle)
python-wikkid 0.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 728 kB
  • sloc: python: 3,051; makefile: 12
file content (55 lines) | stat: -rw-r--r-- 1,456 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#
# Copyright (C) 2010 Wikkid Developers.
#
# This software is licensed under the GNU Affero General Public License
# version 3 (see the file LICENSE).

"""The wikkid tests and test only code."""

import unittest

import testtools
from zope.interface.verify import verifyObject


class ProvidesMixin(object):

    def assertProvides(self, obj, interface):
        """Assert 'obj' correctly provides 'interface'."""
        self.assertTrue(
            interface.providedBy(obj),
            "%r does not provide %r." % (obj, interface))
        self.assertTrue(
            verifyObject(interface, obj),
            "%r claims to provide %r but does not do so correctly."
            % (obj, interface))


class TestCase(testtools.TestCase, ProvidesMixin):
    """Add some zope interface helpers."""


def test_suite():
    packages = [
        'formatters',
        'views',
        ]
    names = [
        'app',
        'context',
        'model_factory',
        'volatile_filestore',
        'bzr_filestore',
        'bzr_user',
        'git_filestore',
        'view_dispatcher',
        'model',
        ]
    module_names = ['wikkid.tests.test_' + name for name in names]
    loader = unittest.TestLoader()
    suite = loader.loadTestsFromNames(module_names)
    for pkgname in packages:
        pkg = __import__(
            'wikkid.tests.' + pkgname, globals(), locals(), ['test_suite'])
        suite.addTests(pkg.test_suite())
    return suite