author | Julien Cristau <julien.cristau@logilab.fr> |
Wed, 09 Sep 2015 09:37:14 +0200 | |
changeset 10654 | d6d9913753d2 |
parent 10214 | 88f60d4b9952 |
permissions | -rw-r--r-- |
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 | 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 | 29 |
|
10214
88f60d4b9952
[newcube] Make the generated code PEP-8 compliant
Christophe de Vienne <christophe@unlish.com>
parents:
6898
diff
changeset
|
30 |
|
5915
e6cc50932720
[skel] nicer test file skeleton
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5424
diff
changeset
|
31 |
class DefaultTC(testlib.CubicWebTC): |
0 | 32 |
def test_something(self): |
6898
60cbb2b39ca9
[skel] try to generate warning free stub...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5915
diff
changeset
|
33 |
self.skipTest('this cube has no test') |
0 | 34 |
|
35 |
||
36 |
if __name__ == '__main__': |
|
5915
e6cc50932720
[skel] nicer test file skeleton
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5424
diff
changeset
|
37 |
from logilab.common.testlib import unittest_main |
0 | 38 |
unittest_main() |