annotate MoinMoin/conftest.py @ 4029:3d5c4ebe8f34

tests: do not use TestConfig class name because py.test thinks that is a test
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 24 Aug 2008 16:35:51 +0200
parents 5c78ac77c98f
children 8a1c8fb7c689
rev   line source
2006
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
1 # -*- coding: iso-8859-1 -*-
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
2 """
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
3 MoinMoin Testing Framework
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
4 --------------------------
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
5
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
6 All test modules must be named test_modulename to be included in the
2264
b0031a34f96d fixed some typos
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2175
diff changeset
7 test suite. If you are testing a package, name the test module
2006
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
8 test_package_module.
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
9
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
10 Tests that need the current request, for example to create a page
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
11 instance, can refer to self.request. It is injected into all test case
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
12 classes by the framework.
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
13
2264
b0031a34f96d fixed some typos
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2175
diff changeset
14 Tests that require a certain configuration, like section_numbers = 1, must
4029
3d5c4ebe8f34 tests: do not use TestConfig class name because py.test thinks that is a test
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4028
diff changeset
15 use a Config class to define the required configuration within the test class.
2006
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
16
4028
5c78ac77c98f tests: minor cleanups, remove unused code, fix (c)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4027
diff changeset
17 @copyright: 2005 MoinMoin:NirSoffer,
5c78ac77c98f tests: minor cleanups, remove unused code, fix (c)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4027
diff changeset
18 2007 MoinMoin:AlexanderSchremmer,
5c78ac77c98f tests: minor cleanups, remove unused code, fix (c)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4027
diff changeset
19 2008 MoinMoin:ThomasWaldmann
2006
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
20 @license: GNU GPL, see COPYING for details.
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
21 """
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
22
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
23 import atexit
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
24 import sys
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
25
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
26 import py
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
27
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
28 rootdir = py.magic.autopath().dirpath()
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
29 moindir = rootdir.join("..")
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
30 sys.path.insert(0, str(moindir))
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
31
2595
5e7b45489430 moved python2.3/2.4 compatibility code to MoinMoin.support.python_compatibility (thanks to Heinrich Wendel)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
32 from MoinMoin.support.python_compatibility import set
4028
5c78ac77c98f tests: minor cleanups, remove unused code, fix (c)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4027
diff changeset
33 from MoinMoin._tests import maketestwiki, compat, wikiconfig
5c78ac77c98f tests: minor cleanups, remove unused code, fix (c)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4027
diff changeset
34 sys.modules["unittest"] = compat # evil hack
2006
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
35
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
36 coverage_modules = set()
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
37
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
38 try:
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
39 """
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
40 This code adds support for coverage.py (see
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
41 http://nedbatchelder.com/code/modules/coverage.html).
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
42 It prints a coverage report for the modules specified in all
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
43 module globals (of the test modules) named "coverage_modules".
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
44 """
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
45
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
46 import coverage
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
47
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
48 def report_coverage():
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
49 coverage.stop()
4028
5c78ac77c98f tests: minor cleanups, remove unused code, fix (c)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4027
diff changeset
50 module_list = [sys.modules[mod] for mod in coverage_modules]
2006
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
51 module_list.sort()
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
52 coverage.report(module_list)
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
53
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
54 def callback(option, opt_str, value, parser):
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
55 atexit.register(report_coverage)
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
56 coverage.erase()
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
57 coverage.start()
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
58
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
59
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
60 py.test.config.addoptions('MoinMoin options', py.test.config.Option('-C',
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
61 '--coverage', action='callback', callback=callback,
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
62 help='Output information about code coverage (slow!)'))
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
63
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
64 except ImportError:
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
65 coverage = None
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
66
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
67
4027
0d6724b87856 Refactored TestConfig creation for py.test based unit tests.
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3944
diff changeset
68 def init_test_request(given_config=None, static_state=[False]):
2338
b902f2397c68 rename server and request Implementations by adding a prefix server_, request_
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 2286
diff changeset
69 from MoinMoin.request import request_cli
2006
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
70 from MoinMoin.user import User
2175
7a3f7ac4f6e0 fix formatter setup for tests, skip broken dom_xml formatter test, add small/big to text_xml formatter (ported from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2013
diff changeset
71 from MoinMoin.formatter.text_html import Formatter as HtmlFormatter
2006
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
72 if not static_state[0]:
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
73 maketestwiki.run(True)
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
74 static_state[0] = True
4027
0d6724b87856 Refactored TestConfig creation for py.test based unit tests.
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3944
diff changeset
75 request = request_cli.Request(given_config=given_config)
2006
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
76 request.form = request.args = request.setup_args()
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
77 request.user = User(request)
2175
7a3f7ac4f6e0 fix formatter setup for tests, skip broken dom_xml formatter test, add small/big to text_xml formatter (ported from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2013
diff changeset
78 request.html_formatter = HtmlFormatter(request)
7a3f7ac4f6e0 fix formatter setup for tests, skip broken dom_xml formatter test, add small/big to text_xml formatter (ported from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2013
diff changeset
79 request.formatter = request.html_formatter
2006
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
80 return request
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
81
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
82
2280
27cd29db1b96 Fix conftest to allow generative tests.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 2264
diff changeset
83 # py.test customization starts here
2006
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
84
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
85 class MoinTestFunction(py.test.collect.Function):
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
86 def execute(self, target, *args):
3944
a86a245db9cb Backed out changeset 28442c70f757, it introduced the idea to create the request more
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 3937
diff changeset
87 request = self.parent.request
2006
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
88 co = target.func_code
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
89 if 'request' in co.co_varnames[:co.co_argcount]:
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
90 target(request, *args)
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
91 else:
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
92 target(*args)
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
93
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
94
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
95 class MoinClassCollector(py.test.collect.Class):
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
96 Function = MoinTestFunction
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
97
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
98 def setup(self):
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
99 cls = self.obj
4029
3d5c4ebe8f34 tests: do not use TestConfig class name because py.test thinks that is a test
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4028
diff changeset
100 if hasattr(cls, 'Config'):
3d5c4ebe8f34 tests: do not use TestConfig class name because py.test thinks that is a test
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4028
diff changeset
101 cls.request = init_test_request(given_config=cls.Config)
4027
0d6724b87856 Refactored TestConfig creation for py.test based unit tests.
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3944
diff changeset
102 else:
0d6724b87856 Refactored TestConfig creation for py.test based unit tests.
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3944
diff changeset
103 cls.request = self.parent.request
2006
1339d6fdc4ff Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
104 super(MoinClassCollector, self).setup()
2280
27cd29db1b96 Fix conftest to allow generative tests.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 2264
diff changeset
105
27cd29db1b96 Fix conftest to allow generative tests.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 2264
diff changeset
106
27cd29db1b96 Fix conftest to allow generative tests.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 2264
diff changeset
107 class Module(py.test.collect.Module):
27cd29db1b96 Fix conftest to allow generative tests.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 2264
diff changeset
108 Class = MoinClassCollector
27cd29db1b96 Fix conftest to allow generative tests.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 2264
diff changeset
109 Function = MoinTestFunction
27cd29db1b96 Fix conftest to allow generative tests.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 2264
diff changeset
110
3944
a86a245db9cb Backed out changeset 28442c70f757, it introduced the idea to create the request more
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 3937
diff changeset
111 def __init__(self, *args, **kwargs):
4027
0d6724b87856 Refactored TestConfig creation for py.test based unit tests.
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3944
diff changeset
112 self.request = init_test_request(given_config=wikiconfig.Config)
3944
a86a245db9cb Backed out changeset 28442c70f757, it introduced the idea to create the request more
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 3937
diff changeset
113 super(Module, self).__init__(*args, **kwargs)
a86a245db9cb Backed out changeset 28442c70f757, it introduced the idea to create the request more
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 3937
diff changeset
114
2280
27cd29db1b96 Fix conftest to allow generative tests.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 2264
diff changeset
115 def run(self, *args, **kwargs):
27cd29db1b96 Fix conftest to allow generative tests.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 2264
diff changeset
116 if coverage is not None:
27cd29db1b96 Fix conftest to allow generative tests.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 2264
diff changeset
117 coverage_modules.update(getattr(self.obj, 'coverage_modules', []))
27cd29db1b96 Fix conftest to allow generative tests.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 2264
diff changeset
118 return super(Module, self).run(*args, **kwargs)
27cd29db1b96 Fix conftest to allow generative tests.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 2264
diff changeset
119