zope.pytestlayer 8.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- zope/pytestlayer/__init__.py +0 -0
- zope/pytestlayer/_compat.py +18 -0
- zope/pytestlayer/doctest.py +31 -0
- zope/pytestlayer/fixture.py +234 -0
- zope/pytestlayer/layered.py +100 -0
- zope/pytestlayer/plugin.py +122 -0
- zope/pytestlayer/testing.py +6 -0
- zope/pytestlayer/tests/__init__.py +0 -0
- zope/pytestlayer/tests/conftest.py +3 -0
- zope/pytestlayer/tests/fixture/bad_layer/__init__.py +0 -0
- zope/pytestlayer/tests/fixture/bad_layer/conftest.py +1 -0
- zope/pytestlayer/tests/fixture/bad_layer/test_core.py +13 -0
- zope/pytestlayer/tests/fixture/custom_fixture_name/__init__.py +0 -0
- zope/pytestlayer/tests/fixture/custom_fixture_name/conftest.py +12 -0
- zope/pytestlayer/tests/fixture/custom_fixture_name/test_core.py +38 -0
- zope/pytestlayer/tests/fixture/keep_layer_across_test_classes/__init__.py +0 -0
- zope/pytestlayer/tests/fixture/keep_layer_across_test_classes/conftest.py +1 -0
- zope/pytestlayer/tests/fixture/keep_layer_across_test_classes/test_core.py +101 -0
- zope/pytestlayer/tests/fixture/layers_with_same_name/__init__.py +0 -0
- zope/pytestlayer/tests/fixture/layers_with_same_name/conftest.py +1 -0
- zope/pytestlayer/tests/fixture/layers_with_same_name/test_core.py +40 -0
- zope/pytestlayer/tests/fixture/no_setup_or_teardown/__init__.py +0 -0
- zope/pytestlayer/tests/fixture/no_setup_or_teardown/conftest.py +1 -0
- zope/pytestlayer/tests/fixture/no_setup_or_teardown/test_core.py +14 -0
- zope/pytestlayer/tests/fixture/order_by_layer/__init__.py +0 -0
- zope/pytestlayer/tests/fixture/order_by_layer/conftest.py +1 -0
- zope/pytestlayer/tests/fixture/order_by_layer/test_core.py +112 -0
- zope/pytestlayer/tests/fixture/order_with_layered_suite/__init__.py +0 -0
- zope/pytestlayer/tests/fixture/order_with_layered_suite/conftest.py +1 -0
- zope/pytestlayer/tests/fixture/order_with_layered_suite/foo.txt +14 -0
- zope/pytestlayer/tests/fixture/order_with_layered_suite/foobar.txt +14 -0
- zope/pytestlayer/tests/fixture/order_with_layered_suite/test_core.py +139 -0
- zope/pytestlayer/tests/fixture/session_fixture/__init__.py +0 -0
- zope/pytestlayer/tests/fixture/session_fixture/conftest.py +13 -0
- zope/pytestlayer/tests/fixture/session_fixture/test_core.py +37 -0
- zope/pytestlayer/tests/fixture/shared_with_layered_suite/__init__.py +0 -0
- zope/pytestlayer/tests/fixture/shared_with_layered_suite/conftest.py +1 -0
- zope/pytestlayer/tests/fixture/shared_with_layered_suite/mydoctest.txt +10 -0
- zope/pytestlayer/tests/fixture/shared_with_layered_suite/test_core.py +53 -0
- zope/pytestlayer/tests/fixture/single_layer/__init__.py +0 -0
- zope/pytestlayer/tests/fixture/single_layer/conftest.py +1 -0
- zope/pytestlayer/tests/fixture/single_layer/test_core.py +33 -0
- zope/pytestlayer/tests/fixture/single_layer_in_two_modules/__init__.py +0 -0
- zope/pytestlayer/tests/fixture/single_layer_in_two_modules/conftest.py +1 -0
- zope/pytestlayer/tests/fixture/single_layer_in_two_modules/test_core.py +33 -0
- zope/pytestlayer/tests/fixture/single_layer_in_two_modules/test_second_module.py +12 -0
- zope/pytestlayer/tests/fixture/single_layer_with_unattached_base_layer/__init__.py +0 -0
- zope/pytestlayer/tests/fixture/single_layer_with_unattached_base_layer/conftest.py +1 -0
- zope/pytestlayer/tests/fixture/single_layer_with_unattached_base_layer/test_core.py +54 -0
- zope/pytestlayer/tests/fixture/single_layered_suite/__init__.py +0 -0
- zope/pytestlayer/tests/fixture/single_layered_suite/conftest.py +1 -0
- zope/pytestlayer/tests/fixture/single_layered_suite/doctest.txt +10 -0
- zope/pytestlayer/tests/fixture/single_layered_suite/test_core.py +44 -0
- zope/pytestlayer/tests/fixture/two_dependent_layered_suites/__init__.py +0 -0
- zope/pytestlayer/tests/fixture/two_dependent_layered_suites/bar.txt +14 -0
- zope/pytestlayer/tests/fixture/two_dependent_layered_suites/conftest.py +1 -0
- zope/pytestlayer/tests/fixture/two_dependent_layered_suites/foo.txt +14 -0
- zope/pytestlayer/tests/fixture/two_dependent_layered_suites/test_core.py +72 -0
- zope/pytestlayer/tests/fixture/two_dependent_layers/__init__.py +0 -0
- zope/pytestlayer/tests/fixture/two_dependent_layers/conftest.py +1 -0
- zope/pytestlayer/tests/fixture/two_dependent_layers/test_core.py +67 -0
- zope/pytestlayer/tests/fixture/two_independent_layers/__init__.py +0 -0
- zope/pytestlayer/tests/fixture/two_independent_layers/conftest.py +1 -0
- zope/pytestlayer/tests/fixture/two_independent_layers/test_core.py +67 -0
- zope/pytestlayer/tests/fixture/with_and_without_layer/__init__.py +0 -0
- zope/pytestlayer/tests/fixture/with_and_without_layer/conftest.py +1 -0
- zope/pytestlayer/tests/fixture/with_and_without_layer/test_core.py +39 -0
- zope/pytestlayer/tests/test_doctest.py +16 -0
- zope/pytestlayer/tests/test_fixture.py +17 -0
- zope/pytestlayer/tests/test_integration.py +524 -0
- zope/pytestlayer/tests/test_layer.py +13 -0
- zope.pytestlayer-8.2-py3.11-nspkg.pth +1 -0
- zope.pytestlayer-8.2.dist-info/LICENSE.txt +43 -0
- zope.pytestlayer-8.2.dist-info/METADATA +318 -0
- zope.pytestlayer-8.2.dist-info/RECORD +79 -0
- zope.pytestlayer-8.2.dist-info/WHEEL +5 -0
- zope.pytestlayer-8.2.dist-info/entry_points.txt +2 -0
- zope.pytestlayer-8.2.dist-info/namespace_packages.txt +1 -0
- zope.pytestlayer-8.2.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
|
|
3
|
+
from zope.pytestlayer.testing import log_to_terminal
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class FooLayer(object):
|
|
7
|
+
|
|
8
|
+
@classmethod
|
|
9
|
+
def setUp(cls):
|
|
10
|
+
cls.layer_foo = 'layer foo'
|
|
11
|
+
|
|
12
|
+
@classmethod
|
|
13
|
+
def tearDown(cls):
|
|
14
|
+
del cls.layer_foo
|
|
15
|
+
|
|
16
|
+
@classmethod
|
|
17
|
+
def testSetUp(cls):
|
|
18
|
+
log_to_terminal(cls.pytest_request, 'testSetUp foo')
|
|
19
|
+
cls.test_foo = 'test foo'
|
|
20
|
+
|
|
21
|
+
@classmethod
|
|
22
|
+
def testTearDown(cls):
|
|
23
|
+
log_to_terminal(cls.pytest_request, 'testTearDown foo')
|
|
24
|
+
del cls.test_foo
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class BarLayer(object):
|
|
28
|
+
|
|
29
|
+
@classmethod
|
|
30
|
+
def setUp(cls):
|
|
31
|
+
cls.layer_bar = 'layer bar'
|
|
32
|
+
|
|
33
|
+
@classmethod
|
|
34
|
+
def tearDown(cls):
|
|
35
|
+
del cls.layer_bar
|
|
36
|
+
|
|
37
|
+
@classmethod
|
|
38
|
+
def testSetUp(cls):
|
|
39
|
+
log_to_terminal(cls.pytest_request, 'testSetUp bar')
|
|
40
|
+
cls.test_bar = 'test bar'
|
|
41
|
+
|
|
42
|
+
@classmethod
|
|
43
|
+
def testTearDown(cls):
|
|
44
|
+
log_to_terminal(cls.pytest_request, 'testTearDown bar')
|
|
45
|
+
del cls.test_bar
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class FooBarLayer(FooLayer, BarLayer):
|
|
49
|
+
|
|
50
|
+
@classmethod
|
|
51
|
+
def setUp(cls):
|
|
52
|
+
cls.layer_foobar = 'layer foobar'
|
|
53
|
+
|
|
54
|
+
@classmethod
|
|
55
|
+
def tearDown(cls):
|
|
56
|
+
del cls.layer_foobar
|
|
57
|
+
|
|
58
|
+
@classmethod
|
|
59
|
+
def testSetUp(cls):
|
|
60
|
+
log_to_terminal(cls.pytest_request, 'testSetUp foobar')
|
|
61
|
+
cls.test_foobar = 'test foobar'
|
|
62
|
+
|
|
63
|
+
@classmethod
|
|
64
|
+
def testTearDown(cls):
|
|
65
|
+
log_to_terminal(cls.pytest_request, 'testTearDown foobar')
|
|
66
|
+
del cls.test_foobar
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class FooTest(unittest.TestCase):
|
|
70
|
+
|
|
71
|
+
layer = FooLayer
|
|
72
|
+
|
|
73
|
+
def test_dummy(self):
|
|
74
|
+
self.assertEqual('layer foo', self.layer.layer_foo)
|
|
75
|
+
self.assertEqual('test foo', self.layer.test_foo)
|
|
76
|
+
self.assertFalse(hasattr(self.layer, 'layer_bar'))
|
|
77
|
+
self.assertFalse(hasattr(self.layer, 'test_bar'))
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class FooBarTest(unittest.TestCase):
|
|
81
|
+
|
|
82
|
+
layer = FooBarLayer
|
|
83
|
+
|
|
84
|
+
def test_dummy(self):
|
|
85
|
+
self.assertEqual('layer foo', self.layer.layer_foo)
|
|
86
|
+
self.assertEqual('test foo', self.layer.test_foo)
|
|
87
|
+
self.assertEqual('layer bar', self.layer.layer_bar)
|
|
88
|
+
self.assertEqual('test bar', self.layer.test_bar)
|
|
89
|
+
self.assertEqual('layer foobar', self.layer.layer_foobar)
|
|
90
|
+
self.assertEqual('test foobar', self.layer.test_foobar)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
class BarTest(unittest.TestCase):
|
|
94
|
+
|
|
95
|
+
layer = BarLayer
|
|
96
|
+
|
|
97
|
+
def test_dummy(self):
|
|
98
|
+
self.assertFalse(hasattr(self.layer, 'layer_foo'))
|
|
99
|
+
self.assertFalse(hasattr(self.layer, 'test_foo'))
|
|
100
|
+
self.assertEqual('layer bar', self.layer.layer_bar)
|
|
101
|
+
self.assertEqual('test bar', self.layer.test_bar)
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pytest_plugins = ('zopelayer', )
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class Layer(object):
|
|
5
|
+
|
|
6
|
+
def __init__(self, value, bases=()):
|
|
7
|
+
self.__name__ = 'TestLayer'
|
|
8
|
+
self.__bases__ = bases
|
|
9
|
+
self.value = value
|
|
10
|
+
|
|
11
|
+
def setUp(self):
|
|
12
|
+
self.set_up_value = self.value
|
|
13
|
+
|
|
14
|
+
def tearDown(self):
|
|
15
|
+
del self.set_up_value
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
FooLayer = Layer('foo-layer')
|
|
19
|
+
BarLayer = Layer('bar-layer')
|
|
20
|
+
FooBarLayer = Layer('foobar-layer', bases=(FooLayer, BarLayer))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class FooTest(unittest.TestCase):
|
|
24
|
+
|
|
25
|
+
layer = FooLayer
|
|
26
|
+
|
|
27
|
+
def test_dummy(self):
|
|
28
|
+
self.assertEqual('foo-layer', self.layer.set_up_value)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class BarTest(unittest.TestCase):
|
|
32
|
+
|
|
33
|
+
layer = BarLayer
|
|
34
|
+
|
|
35
|
+
def test_dummy(self):
|
|
36
|
+
self.assertEqual('bar-layer', self.layer.set_up_value)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
del FooLayer
|
|
40
|
+
del BarLayer
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pytest_plugins = ('zopelayer', )
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pytest_plugins = ('zopelayer', )
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
|
|
3
|
+
from zope.pytestlayer.testing import log_to_terminal
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class FooLayer(object):
|
|
7
|
+
|
|
8
|
+
@classmethod
|
|
9
|
+
def setUp(cls):
|
|
10
|
+
cls.layer_foo = 'layer foo'
|
|
11
|
+
|
|
12
|
+
@classmethod
|
|
13
|
+
def tearDown(cls):
|
|
14
|
+
del cls.layer_foo
|
|
15
|
+
|
|
16
|
+
@classmethod
|
|
17
|
+
def testSetUp(cls):
|
|
18
|
+
log_to_terminal(cls.pytest_request, 'testSetUp foo')
|
|
19
|
+
cls.test_foo = 'test foo'
|
|
20
|
+
|
|
21
|
+
@classmethod
|
|
22
|
+
def testTearDown(cls):
|
|
23
|
+
log_to_terminal(cls.pytest_request, 'testTearDown foo')
|
|
24
|
+
del cls.test_foo
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class BarLayer(object):
|
|
28
|
+
|
|
29
|
+
@classmethod
|
|
30
|
+
def setUp(cls):
|
|
31
|
+
cls.layer_bar = 'layer bar'
|
|
32
|
+
|
|
33
|
+
@classmethod
|
|
34
|
+
def tearDown(cls):
|
|
35
|
+
del cls.layer_bar
|
|
36
|
+
|
|
37
|
+
@classmethod
|
|
38
|
+
def testSetUp(cls):
|
|
39
|
+
log_to_terminal(cls.pytest_request, 'testSetUp bar')
|
|
40
|
+
cls.test_bar = 'test bar'
|
|
41
|
+
|
|
42
|
+
@classmethod
|
|
43
|
+
def testTearDown(cls):
|
|
44
|
+
log_to_terminal(cls.pytest_request, 'testTearDown bar')
|
|
45
|
+
del cls.test_bar
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class FooBarLayer(FooLayer, BarLayer):
|
|
49
|
+
|
|
50
|
+
@classmethod
|
|
51
|
+
def setUp(cls):
|
|
52
|
+
cls.layer_foobar = 'layer foobar'
|
|
53
|
+
|
|
54
|
+
@classmethod
|
|
55
|
+
def tearDown(cls):
|
|
56
|
+
del cls.layer_foobar
|
|
57
|
+
|
|
58
|
+
@classmethod
|
|
59
|
+
def testSetUp(cls):
|
|
60
|
+
log_to_terminal(cls.pytest_request, 'testSetUp foobar')
|
|
61
|
+
cls.test_foobar = 'test foobar'
|
|
62
|
+
|
|
63
|
+
@classmethod
|
|
64
|
+
def testTearDown(cls):
|
|
65
|
+
log_to_terminal(cls.pytest_request, 'testTearDown foobar')
|
|
66
|
+
del cls.test_foobar
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class FooTest(unittest.TestCase):
|
|
70
|
+
|
|
71
|
+
layer = FooLayer
|
|
72
|
+
|
|
73
|
+
def test_dummy(self):
|
|
74
|
+
self.assertEqual('layer foo', self.layer.layer_foo)
|
|
75
|
+
self.assertEqual('test foo', self.layer.test_foo)
|
|
76
|
+
self.assertFalse(hasattr(self.layer, 'layer_bar'))
|
|
77
|
+
self.assertFalse(hasattr(self.layer, 'test_bar'))
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class BarTest(unittest.TestCase):
|
|
81
|
+
|
|
82
|
+
layer = BarLayer
|
|
83
|
+
|
|
84
|
+
def test_dummy(self):
|
|
85
|
+
self.assertFalse(hasattr(self.layer, 'layer_foo'))
|
|
86
|
+
self.assertFalse(hasattr(self.layer, 'test_foo'))
|
|
87
|
+
self.assertEqual('layer bar', self.layer.layer_bar)
|
|
88
|
+
self.assertEqual('test bar', self.layer.test_bar)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
class FooBarTest(unittest.TestCase):
|
|
92
|
+
|
|
93
|
+
layer = FooBarLayer
|
|
94
|
+
|
|
95
|
+
def test_dummy(self):
|
|
96
|
+
self.assertEqual('layer foo', self.layer.layer_foo)
|
|
97
|
+
self.assertEqual('test foo', self.layer.test_foo)
|
|
98
|
+
self.assertEqual('layer bar', self.layer.layer_bar)
|
|
99
|
+
self.assertEqual('test bar', self.layer.test_bar)
|
|
100
|
+
self.assertEqual('layer foobar', self.layer.layer_foobar)
|
|
101
|
+
self.assertEqual('test foobar', self.layer.test_foobar)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
class Bar2Test(unittest.TestCase):
|
|
105
|
+
|
|
106
|
+
layer = BarLayer
|
|
107
|
+
|
|
108
|
+
def test_dummy(self):
|
|
109
|
+
self.assertFalse(hasattr(self.layer, 'layer_foo'))
|
|
110
|
+
self.assertFalse(hasattr(self.layer, 'test_foo'))
|
|
111
|
+
self.assertEqual('layer bar', self.layer.layer_bar)
|
|
112
|
+
self.assertEqual('test bar', self.layer.test_bar)
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pytest_plugins = ('zopelayer', )
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Test layered suite
|
|
2
|
+
------------------
|
|
3
|
+
|
|
4
|
+
>>> layer
|
|
5
|
+
<class 'order_with_layered_suite.test_core.FooLayer'>
|
|
6
|
+
|
|
7
|
+
>>> layer.layer_foo
|
|
8
|
+
'layer foo'
|
|
9
|
+
>>> layer.test_foo
|
|
10
|
+
'test foo'
|
|
11
|
+
>>> hasattr(layer, 'layer_bar')
|
|
12
|
+
False
|
|
13
|
+
>>> hasattr(layer, 'test_bar')
|
|
14
|
+
False
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Test layered suite
|
|
2
|
+
------------------
|
|
3
|
+
|
|
4
|
+
>>> layer
|
|
5
|
+
<class 'order_with_layered_suite.test_core.FooBarLayer'>
|
|
6
|
+
|
|
7
|
+
>>> layer.layer_foo
|
|
8
|
+
'layer foo'
|
|
9
|
+
>>> layer.test_foo
|
|
10
|
+
'test foo'
|
|
11
|
+
>>> layer.layer_bar
|
|
12
|
+
'layer bar'
|
|
13
|
+
>>> layer.test_bar
|
|
14
|
+
'test bar'
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import doctest
|
|
2
|
+
import unittest
|
|
3
|
+
|
|
4
|
+
from plone.testing import layered
|
|
5
|
+
|
|
6
|
+
from zope.pytestlayer.testing import log_to_terminal
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class FooLayer(object):
|
|
10
|
+
|
|
11
|
+
@classmethod
|
|
12
|
+
def setUp(cls):
|
|
13
|
+
cls.layer_foo = 'layer foo'
|
|
14
|
+
|
|
15
|
+
@classmethod
|
|
16
|
+
def tearDown(cls):
|
|
17
|
+
del cls.layer_foo
|
|
18
|
+
|
|
19
|
+
@classmethod
|
|
20
|
+
def testSetUp(cls):
|
|
21
|
+
log_to_terminal(cls.pytest_request, 'testSetUp foo')
|
|
22
|
+
cls.test_foo = 'test foo'
|
|
23
|
+
|
|
24
|
+
@classmethod
|
|
25
|
+
def testTearDown(cls):
|
|
26
|
+
log_to_terminal(cls.pytest_request, 'testTearDown foo')
|
|
27
|
+
del cls.test_foo
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class BarLayer(object):
|
|
31
|
+
|
|
32
|
+
@classmethod
|
|
33
|
+
def setUp(cls):
|
|
34
|
+
cls.layer_bar = 'layer bar'
|
|
35
|
+
|
|
36
|
+
@classmethod
|
|
37
|
+
def tearDown(cls):
|
|
38
|
+
del cls.layer_bar
|
|
39
|
+
|
|
40
|
+
@classmethod
|
|
41
|
+
def testSetUp(cls):
|
|
42
|
+
log_to_terminal(cls.pytest_request, 'testSetUp bar')
|
|
43
|
+
cls.test_bar = 'test bar'
|
|
44
|
+
|
|
45
|
+
@classmethod
|
|
46
|
+
def testTearDown(cls):
|
|
47
|
+
log_to_terminal(cls.pytest_request, 'testTearDown bar')
|
|
48
|
+
del cls.test_bar
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class FooBarLayer(FooLayer, BarLayer):
|
|
52
|
+
|
|
53
|
+
@classmethod
|
|
54
|
+
def setUp(cls):
|
|
55
|
+
cls.layer_foobar = 'layer foobar'
|
|
56
|
+
|
|
57
|
+
@classmethod
|
|
58
|
+
def tearDown(cls):
|
|
59
|
+
del cls.layer_foobar
|
|
60
|
+
|
|
61
|
+
@classmethod
|
|
62
|
+
def testSetUp(cls):
|
|
63
|
+
log_to_terminal(cls.pytest_request, 'testSetUp foobar')
|
|
64
|
+
cls.test_foobar = 'test foobar'
|
|
65
|
+
|
|
66
|
+
@classmethod
|
|
67
|
+
def testTearDown(cls):
|
|
68
|
+
log_to_terminal(cls.pytest_request, 'testTearDown foobar')
|
|
69
|
+
del cls.test_foobar
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
class FooTest(unittest.TestCase):
|
|
73
|
+
|
|
74
|
+
layer = FooLayer
|
|
75
|
+
|
|
76
|
+
def test_dummy(self):
|
|
77
|
+
self.assertEqual('layer foo', self.layer.layer_foo)
|
|
78
|
+
self.assertEqual('test foo', self.layer.test_foo)
|
|
79
|
+
self.assertFalse(hasattr(self.layer, 'layer_bar'))
|
|
80
|
+
self.assertFalse(hasattr(self.layer, 'test_bar'))
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
class BarTest(unittest.TestCase):
|
|
84
|
+
|
|
85
|
+
layer = BarLayer
|
|
86
|
+
|
|
87
|
+
def test_dummy(self):
|
|
88
|
+
self.assertFalse(hasattr(self.layer, 'layer_foo'))
|
|
89
|
+
self.assertFalse(hasattr(self.layer, 'test_foo'))
|
|
90
|
+
self.assertEqual('layer bar', self.layer.layer_bar)
|
|
91
|
+
self.assertEqual('test bar', self.layer.test_bar)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
class FooBarTest(unittest.TestCase):
|
|
95
|
+
|
|
96
|
+
layer = FooBarLayer
|
|
97
|
+
|
|
98
|
+
def test_dummy(self):
|
|
99
|
+
self.assertEqual('layer foo', self.layer.layer_foo)
|
|
100
|
+
self.assertEqual('test foo', self.layer.test_foo)
|
|
101
|
+
self.assertEqual('layer bar', self.layer.layer_bar)
|
|
102
|
+
self.assertEqual('test bar', self.layer.test_bar)
|
|
103
|
+
self.assertEqual('layer foobar', self.layer.layer_foobar)
|
|
104
|
+
self.assertEqual('test foobar', self.layer.test_foobar)
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
class Bar2Test(unittest.TestCase):
|
|
108
|
+
|
|
109
|
+
layer = BarLayer
|
|
110
|
+
|
|
111
|
+
def test_dummy(self):
|
|
112
|
+
self.assertFalse(hasattr(self.layer, 'layer_foo'))
|
|
113
|
+
self.assertFalse(hasattr(self.layer, 'test_foo'))
|
|
114
|
+
self.assertEqual('layer bar', self.layer.layer_bar)
|
|
115
|
+
self.assertEqual('test bar', self.layer.test_bar)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def test_suite():
|
|
119
|
+
suite = unittest.TestSuite()
|
|
120
|
+
|
|
121
|
+
OPTIONFLAGS = (doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE)
|
|
122
|
+
|
|
123
|
+
suite.addTests([
|
|
124
|
+
layered(
|
|
125
|
+
doctest.DocFileSuite(
|
|
126
|
+
'foo.txt',
|
|
127
|
+
optionflags=OPTIONFLAGS,
|
|
128
|
+
),
|
|
129
|
+
layer=FooLayer,
|
|
130
|
+
),
|
|
131
|
+
layered(
|
|
132
|
+
doctest.DocFileSuite(
|
|
133
|
+
'foobar.txt',
|
|
134
|
+
optionflags=OPTIONFLAGS,
|
|
135
|
+
),
|
|
136
|
+
layer=FooBarLayer,
|
|
137
|
+
),
|
|
138
|
+
])
|
|
139
|
+
return suite
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from session_fixture.test_core import FooLayer
|
|
2
|
+
|
|
3
|
+
import zope.pytestlayer.fixture
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
pytest_plugins = ('zopelayer', )
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
globals().update(zope.pytestlayer.fixture.create(
|
|
10
|
+
FooLayer,
|
|
11
|
+
session_fixture_name='foo_layer_session',
|
|
12
|
+
class_fixture_name='foo_layer_class',
|
|
13
|
+
function_fixture_name='foo_layer'))
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
|
|
3
|
+
from zope.pytestlayer.testing import log_to_terminal
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class FooLayer(object):
|
|
7
|
+
|
|
8
|
+
@classmethod
|
|
9
|
+
def setUp(cls):
|
|
10
|
+
cls.layer_foo = 'layer foo'
|
|
11
|
+
|
|
12
|
+
@classmethod
|
|
13
|
+
def tearDown(cls):
|
|
14
|
+
del cls.layer_foo
|
|
15
|
+
|
|
16
|
+
@classmethod
|
|
17
|
+
def testSetUp(cls):
|
|
18
|
+
log_to_terminal(cls.pytest_request, 'testSetUp foo')
|
|
19
|
+
cls.test_foo = 'test foo'
|
|
20
|
+
|
|
21
|
+
@classmethod
|
|
22
|
+
def testTearDown(cls):
|
|
23
|
+
log_to_terminal(cls.pytest_request, 'testTearDown foo')
|
|
24
|
+
del cls.test_foo
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def test_can_access_layer_via_fixture(foo_layer_session):
|
|
28
|
+
assert 'layer foo' == foo_layer_session.layer_foo
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class FooTest(unittest.TestCase):
|
|
32
|
+
|
|
33
|
+
layer = FooLayer
|
|
34
|
+
|
|
35
|
+
def test_accesses_fixture_with_generated_name_for_layer(self):
|
|
36
|
+
self.assertEqual('layer foo', self.layer.layer_foo)
|
|
37
|
+
self.assertEqual('test foo', self.layer.test_foo)
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pytest_plugins = ('zopelayer',)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import doctest
|
|
2
|
+
import unittest
|
|
3
|
+
|
|
4
|
+
from plone.testing import layered
|
|
5
|
+
|
|
6
|
+
from zope.pytestlayer.testing import log_to_terminal
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class FooLayer(object):
|
|
10
|
+
|
|
11
|
+
@classmethod
|
|
12
|
+
def setUp(cls):
|
|
13
|
+
cls.layer_foo = 'layer foo'
|
|
14
|
+
|
|
15
|
+
@classmethod
|
|
16
|
+
def tearDown(cls):
|
|
17
|
+
del cls.layer_foo
|
|
18
|
+
|
|
19
|
+
@classmethod
|
|
20
|
+
def testSetUp(cls):
|
|
21
|
+
log_to_terminal(cls.pytest_request, 'testSetUp foo')
|
|
22
|
+
cls.test_foo = 'test foo'
|
|
23
|
+
|
|
24
|
+
@classmethod
|
|
25
|
+
def testTearDown(cls):
|
|
26
|
+
log_to_terminal(cls.pytest_request, 'testTearDown foo')
|
|
27
|
+
del cls.test_foo
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class FooTest(unittest.TestCase):
|
|
31
|
+
|
|
32
|
+
layer = FooLayer
|
|
33
|
+
|
|
34
|
+
def test_dummy(self):
|
|
35
|
+
self.assertEqual('layer foo', self.layer.layer_foo)
|
|
36
|
+
self.assertEqual('test foo', self.layer.test_foo)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def test_suite():
|
|
40
|
+
suite = unittest.TestSuite()
|
|
41
|
+
|
|
42
|
+
OPTIONFLAGS = (doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE)
|
|
43
|
+
|
|
44
|
+
suite.addTests([
|
|
45
|
+
layered(
|
|
46
|
+
doctest.DocFileSuite(
|
|
47
|
+
'mydoctest.txt',
|
|
48
|
+
optionflags=OPTIONFLAGS,
|
|
49
|
+
),
|
|
50
|
+
layer=FooLayer,
|
|
51
|
+
),
|
|
52
|
+
])
|
|
53
|
+
return suite
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pytest_plugins = ('zopelayer', )
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
|
|
3
|
+
from zope.pytestlayer.testing import log_to_terminal
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class FooLayer(object):
|
|
7
|
+
|
|
8
|
+
@classmethod
|
|
9
|
+
def setUp(cls):
|
|
10
|
+
cls.layer_foo = 'layer foo'
|
|
11
|
+
|
|
12
|
+
@classmethod
|
|
13
|
+
def tearDown(cls):
|
|
14
|
+
del cls.layer_foo
|
|
15
|
+
|
|
16
|
+
@classmethod
|
|
17
|
+
def testSetUp(cls):
|
|
18
|
+
log_to_terminal(cls.pytest_request, 'testSetUp foo')
|
|
19
|
+
cls.test_foo = 'test foo'
|
|
20
|
+
|
|
21
|
+
@classmethod
|
|
22
|
+
def testTearDown(cls):
|
|
23
|
+
log_to_terminal(cls.pytest_request, 'testTearDown foo')
|
|
24
|
+
del cls.test_foo
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class FooTest(unittest.TestCase):
|
|
28
|
+
|
|
29
|
+
layer = FooLayer
|
|
30
|
+
|
|
31
|
+
def test_dummy(self):
|
|
32
|
+
self.assertEqual('layer foo', self.layer.layer_foo)
|
|
33
|
+
self.assertEqual('test foo', self.layer.test_foo)
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pytest_plugins = ('zopelayer', )
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
|
|
3
|
+
from zope.pytestlayer.testing import log_to_terminal
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class FooLayer(object):
|
|
7
|
+
|
|
8
|
+
@classmethod
|
|
9
|
+
def setUp(cls):
|
|
10
|
+
cls.layer_foo = 'layer foo'
|
|
11
|
+
|
|
12
|
+
@classmethod
|
|
13
|
+
def tearDown(cls):
|
|
14
|
+
del cls.layer_foo
|
|
15
|
+
|
|
16
|
+
@classmethod
|
|
17
|
+
def testSetUp(cls):
|
|
18
|
+
log_to_terminal(cls.pytest_request, 'testSetUp foo')
|
|
19
|
+
cls.test_foo = 'test foo'
|
|
20
|
+
|
|
21
|
+
@classmethod
|
|
22
|
+
def testTearDown(cls):
|
|
23
|
+
log_to_terminal(cls.pytest_request, 'testTearDown foo')
|
|
24
|
+
del cls.test_foo
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class FooTest(unittest.TestCase):
|
|
28
|
+
|
|
29
|
+
layer = FooLayer
|
|
30
|
+
|
|
31
|
+
def test_dummy(self):
|
|
32
|
+
self.assertEqual('layer foo', self.layer.layer_foo)
|
|
33
|
+
self.assertEqual('test foo', self.layer.test_foo)
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pytest_plugins = ('zopelayer', )
|