skeleton/test/test_CUBENAME.py.tmpl
author Sylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 26 Sep 2011 19:09:12 +0200
branchstable
changeset 7867 0abed94a9859
parent 6898 60cbb2b39ca9
child 10214 88f60d4b9952
permissions -rw-r--r--
fix merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5915
e6cc50932720 [skel] nicer test file skeleton
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
     1
# copyright %(year)s %(author)s, all rights reserved.
e6cc50932720 [skel] nicer test file skeleton
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
     2
# contact %(author-web-site)s -- mailto:%(author-email)s
5421
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4212
diff changeset
     3
#
5915
e6cc50932720 [skel] nicer test file skeleton
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
     4
%(long-license)s
e6cc50932720 [skel] nicer test file skeleton
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
     5
"""%(distname)s automatic tests
e6cc50932720 [skel] nicer test file skeleton
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
     6
e6cc50932720 [skel] nicer test file skeleton
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
     7
e6cc50932720 [skel] nicer test file skeleton
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
     8
uncomment code below if you want to activate automatic test for your cube:
e6cc50932720 [skel] nicer test file skeleton
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
     9
e6cc50932720 [skel] nicer test file skeleton
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    10
.. sourcecode:: python
e6cc50932720 [skel] nicer test file skeleton
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    11
e6cc50932720 [skel] nicer test file skeleton
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    12
    from cubicweb.devtools.testlib import AutomaticWebTest
1977
606923dff11b big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 0
diff changeset
    13
5915
e6cc50932720 [skel] nicer test file skeleton
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    14
    class AutomaticWebTest(AutomaticWebTest):
e6cc50932720 [skel] nicer test file skeleton
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    15
        '''provides `to_test_etypes` and/or `list_startup_views` implementation
e6cc50932720 [skel] nicer test file skeleton
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    16
        to limit test scope
e6cc50932720 [skel] nicer test file skeleton
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    17
        '''
e6cc50932720 [skel] nicer test file skeleton
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    18
e6cc50932720 [skel] nicer test file skeleton
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    19
        def to_test_etypes(self):
e6cc50932720 [skel] nicer test file skeleton
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    20
            '''only test views for entities of the returned types'''
e6cc50932720 [skel] nicer test file skeleton
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    21
            return set(('My', 'Cube', 'Entity', 'Types'))
e6cc50932720 [skel] nicer test file skeleton
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    22
e6cc50932720 [skel] nicer test file skeleton
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    23
        def list_startup_views(self):
e6cc50932720 [skel] nicer test file skeleton
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    24
            '''only test startup views of the returned identifiers'''
e6cc50932720 [skel] nicer test file skeleton
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    25
            return ('some', 'startup', 'views')
1977
606923dff11b big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 0
diff changeset
    26
"""
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    27
5915
e6cc50932720 [skel] nicer test file skeleton
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    28
from cubicweb.devtools import testlib
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    29
5915
e6cc50932720 [skel] nicer test file skeleton
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    30
class DefaultTC(testlib.CubicWebTC):
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    31
    def test_something(self):
6898
60cbb2b39ca9 [skel] try to generate warning free stub...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5915
diff changeset
    32
        self.skipTest('this cube has no test')
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    33
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    34
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    35
if __name__ == '__main__':
5915
e6cc50932720 [skel] nicer test file skeleton
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    36
    from logilab.common.testlib import unittest_main
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    37
    unittest_main()