annotate MoinMoin/conftest.py @ 6124:cf8f1f2a852e

bump version to 1.9.9
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 31 Oct 2016 20:50:01 +0100
parents 500f68d3e2fd
children
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
4321
4476d5ca521c Move imports of werkzeug solely into the MoinMoin.web package (to make bundled werkzeug really work)
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4217
diff changeset
32 from MoinMoin.web.request import TestRequest, Client
4859
6a7395207387 Groups2009: dicts and groups instead of group_manager_init and dict_manager_init are used.
Dmitrijs Milajevs <dimazest@gmail.com>
parents: 4774
diff changeset
33 from MoinMoin.wsgiapp import Application, init
4030
8a1c8fb7c689 Removed unittest compat code. All unit tests were migrated to py.test.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 4029
diff changeset
34 from MoinMoin._tests import maketestwiki, wikiconfig
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 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
60 '--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
61 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
62
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 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
64 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
65
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
4027
0d6724b87856 Refactored TestConfig creation for py.test based unit tests.
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3944
diff changeset
67 def init_test_request(given_config=None, static_state=[False]):
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
68 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
69 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
70 static_state[0] = True
4212
1ca179133f01 Fix tests: small fixes after merge
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4196
diff changeset
71 request = TestRequest()
4327
62177a952833 merged moin/1.8 repo (tests need more fixing)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4326 4030
diff changeset
72 request.given_config = given_config
4217
b231877df090 Added werkzeug.test.Client for blackbox application testing (headers, status, output)
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4212
diff changeset
73 request = init(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
74 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
75
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
2280
27cd29db1b96 Fix conftest to allow generative tests.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 2264
diff changeset
77 # 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
78
4952
2117e64aea4e support py.test 1.0 funcargs (thanks to Holger Krekel for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4030
diff changeset
79 # py.test-1.0 provides "funcargs" natively
2117e64aea4e support py.test 1.0 funcargs (thanks to Holger Krekel for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4030
diff changeset
80 def pytest_funcarg__request(request):
2117e64aea4e support py.test 1.0 funcargs (thanks to Holger Krekel for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4030
diff changeset
81 # note the naminng clash: py.test's funcarg-request object
2117e64aea4e support py.test 1.0 funcargs (thanks to Holger Krekel for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4030
diff changeset
82 # and the request we provide are totally separate things
2117e64aea4e support py.test 1.0 funcargs (thanks to Holger Krekel for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4030
diff changeset
83 cls = request._pyfuncitem.getparent(py.test.collect.Module)
2117e64aea4e support py.test 1.0 funcargs (thanks to Holger Krekel for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4030
diff changeset
84 return cls.request
2117e64aea4e support py.test 1.0 funcargs (thanks to Holger Krekel for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4030
diff changeset
85
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
86 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
87 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
88 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
89 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
90 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
91 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
92 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
93 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
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
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 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
97 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
98
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 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
100 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
101 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
102 cls.request = init_test_request(given_config=cls.Config)
4441
f02b3e7dffe6 fixed wsgiapplication tests
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents: 4327
diff changeset
103 cls.client = Client(Application(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
104 else:
0d6724b87856 Refactored TestConfig creation for py.test based unit tests.
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3944
diff changeset
105 cls.request = self.parent.request
4441
f02b3e7dffe6 fixed wsgiapplication tests
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents: 4327
diff changeset
106 #XXX: this is the extremely messy way to configure the wsgi app
f02b3e7dffe6 fixed wsgiapplication tests
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents: 4327
diff changeset
107 # with the correct testing config
f02b3e7dffe6 fixed wsgiapplication tests
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents: 4327
diff changeset
108 cls.client = Client(Application(self.parent.request.cfg.__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
109 super(MoinClassCollector, self).setup()
2280
27cd29db1b96 Fix conftest to allow generative tests.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 2264
diff changeset
110
27cd29db1b96 Fix conftest to allow generative tests.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 2264
diff changeset
111
27cd29db1b96 Fix conftest to allow generative tests.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 2264
diff changeset
112 class Module(py.test.collect.Module):
27cd29db1b96 Fix conftest to allow generative tests.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 2264
diff changeset
113 Class = MoinClassCollector
27cd29db1b96 Fix conftest to allow generative tests.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 2264
diff changeset
114 Function = MoinTestFunction
27cd29db1b96 Fix conftest to allow generative tests.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 2264
diff changeset
115
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
116 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
117 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
118 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
119
2280
27cd29db1b96 Fix conftest to allow generative tests.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 2264
diff changeset
120 def run(self, *args, **kwargs):
27cd29db1b96 Fix conftest to allow generative tests.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 2264
diff changeset
121 if coverage is not None:
27cd29db1b96 Fix conftest to allow generative tests.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 2264
diff changeset
122 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
123 return super(Module, self).run(*args, **kwargs)