5
5
from allure_commons_test .label import has_tag
6
6
7
7
8
- def test_pytest_marker (allure_pytest_runner : AllurePytestRunner ):
8
+ def test_pytest_simple_markers_are_converted_to_allure_tags (
9
+ allure_pytest_runner : AllurePytestRunner
10
+ ):
9
11
"""
10
12
>>> import pytest
11
13
12
14
>>> @pytest.mark.cool
13
15
... @pytest.mark.stuff
14
- ... def test_pytest_marker_example ():
16
+ ... def test_pytest_simple_markers_are_converted_to_allure_tags_example ():
15
17
... pass
16
18
"""
17
19
@@ -20,15 +22,63 @@ def test_pytest_marker(allure_pytest_runner: AllurePytestRunner):
20
22
assert_that (
21
23
allure_results ,
22
24
has_test_case (
23
- "test_pytest_marker_example " ,
25
+ "test_pytest_simple_markers_are_converted_to_allure_tags_example " ,
24
26
has_tag ("cool" ),
25
27
has_tag ("stuff" )
26
28
)
27
29
)
28
30
29
31
30
- def test_show_reserved_pytest_markers_full_decorator (
31
- allure_pytest_runner : AllurePytestRunner
32
+ def test_pytest_marker_with_args_is_not_converted_to_allure_tag (
33
+ allure_pytest_runner : AllurePytestRunner
34
+ ):
35
+ """
36
+ >>> import pytest
37
+
38
+ >>> @pytest.mark.marker('cool', 'stuff')
39
+ ... def test_pytest_marker_with_args_is_not_converted_to_allure_tag_example():
40
+ ... pass
41
+ """
42
+
43
+ allure_results = allure_pytest_runner .run_docstring ()
44
+
45
+ assert_that (
46
+ allure_results ,
47
+ has_test_case (
48
+ "test_pytest_marker_with_args_is_not_converted_to_allure_tag_example" ,
49
+ not_ (
50
+ has_tag ("marker('cool', 'stuff')" )
51
+ )
52
+ )
53
+ )
54
+
55
+
56
+ def test_pytest_marker_with_kwargs_is_not_converted_to_allure_tag (
57
+ allure_pytest_runner : AllurePytestRunner
58
+ ):
59
+ """
60
+ >>> import pytest
61
+
62
+ >>> @pytest.mark.marker(stuff='cool')
63
+ ... def test_pytest_marker_with_kwargs_is_not_converted_to_allure_tag_example():
64
+ ... pass
65
+ """
66
+
67
+ allure_results = allure_pytest_runner .run_docstring ()
68
+
69
+ assert_that (
70
+ allure_results ,
71
+ has_test_case (
72
+ "test_pytest_marker_with_kwargs_is_not_converted_to_allure_tag_example" ,
73
+ not_ (
74
+ has_tag ("marker(stuff='cool')" )
75
+ )
76
+ )
77
+ )
78
+
79
+
80
+ def test_pytest_multiple_simple_and_reserved_markers_to_allure_tags (
81
+ allure_pytest_runner : AllurePytestRunner
32
82
):
33
83
"""
34
84
>>> import pytest
@@ -38,7 +88,7 @@ def test_show_reserved_pytest_markers_full_decorator(
38
88
... @pytest.mark.parametrize("param", ["foo"])
39
89
... @pytest.mark.skipif(False, reason="reason2")
40
90
... @pytest.mark.skipif(False, reason="reason1")
41
- ... def test_show_reserved_pytest_markers_full_decorator_example (param):
91
+ ... def test_pytest_multiple_simple_and_reserved_markers_to_allure_tags_example (param):
42
92
... pass
43
93
"""
44
94
@@ -47,26 +97,54 @@ def test_show_reserved_pytest_markers_full_decorator(
47
97
assert_that (
48
98
allure_results ,
49
99
has_test_case (
50
- "test_show_reserved_pytest_markers_full_decorator_example [foo]" ,
100
+ "test_pytest_multiple_simple_and_reserved_markers_to_allure_tags_example [foo]" ,
51
101
has_tag ("usermark1" ),
52
102
has_tag ("usermark2" ),
53
- has_tag ("@pytest.mark.skipif(False, reason='reason1')" ),
54
103
not_ (
55
- has_tag ("@pytest.mark.skipif(False, reason='reason2')" )
104
+ has_tag ("skipif(False, reason='reason1')" )
105
+ ),
106
+ not_ (
107
+ has_tag ("skipif(False, reason='reason2')" )
56
108
),
57
109
not_ (
58
- has_tag ("@pytest.mark. parametrize('param', ['foo'])" )
110
+ has_tag ("parametrize('param', ['foo'])" )
59
111
)
60
112
)
61
113
)
62
114
63
115
64
- def test_pytest_xfail_marker (allure_pytest_runner : AllurePytestRunner ):
116
+ def test_pytest_reserved_marker_usefixtures_is_not_converted_to_allure_tag (
117
+ allure_pytest_runner : AllurePytestRunner
118
+ ):
65
119
"""
66
120
>>> import pytest
67
121
68
- >>> @pytest.mark.xfail(reason='this is unexpect pass')
69
- ... def test_pytest_xfail_marker_example():
122
+ >>> @pytest.mark.usefixtures('test_fixture')
123
+ ... def test_pytest_reserved_marker_usefixtures_is_not_converted_to_allure_tag_example():
124
+ ... pass
125
+ """
126
+
127
+ allure_results = allure_pytest_runner .run_docstring ()
128
+
129
+ assert_that (
130
+ allure_results ,
131
+ has_test_case (
132
+ "test_pytest_reserved_marker_usefixtures_is_not_converted_to_allure_tag_example" ,
133
+ not_ (
134
+ has_tag ("usefixtures('test_fixture')" )
135
+ )
136
+ )
137
+ )
138
+
139
+
140
+ def test_pytest_reserved_marker_filterwarnings_is_not_converted_to_allure_tag (
141
+ allure_pytest_runner : AllurePytestRunner
142
+ ):
143
+ """
144
+ >>> import pytest
145
+
146
+ >>> @pytest.mark.filterwarnings('ignore:val')
147
+ ... def test_pytest_reserved_marker_filterwarnings_is_not_converted_to_allure_tag_example():
70
148
... pass
71
149
"""
72
150
@@ -75,18 +153,22 @@ def test_pytest_xfail_marker(allure_pytest_runner: AllurePytestRunner):
75
153
assert_that (
76
154
allure_results ,
77
155
has_test_case (
78
- "test_pytest_xfail_marker_example" ,
79
- has_tag ("@pytest.mark.xfail(reason='this is unexpect pass')" )
156
+ "test_pytest_reserved_marker_filterwarnings_is_not_converted_to_allure_tag_example" ,
157
+ not_ (
158
+ has_tag ("filterwarnings('ignore:val')" )
159
+ )
80
160
)
81
161
)
82
162
83
163
84
- def test_pytest_marker_with_args (allure_pytest_runner : AllurePytestRunner ):
164
+ def test_pytest_reserved_marker_skip_is_not_converted_to_allure_tag (
165
+ allure_pytest_runner : AllurePytestRunner
166
+ ):
85
167
"""
86
168
>>> import pytest
87
169
88
- >>> @pytest.mark.marker('cool', 'stuff ')
89
- ... def test_pytest_marker_with_args_example ():
170
+ >>> @pytest.mark.skip(reason='reason ')
171
+ ... def test_pytest_reserved_marker_skip_is_not_converted_to_allure_tag_example ():
90
172
... pass
91
173
"""
92
174
@@ -95,18 +177,22 @@ def test_pytest_marker_with_args(allure_pytest_runner: AllurePytestRunner):
95
177
assert_that (
96
178
allure_results ,
97
179
has_test_case (
98
- "test_pytest_marker_with_args_example" ,
99
- has_tag ("marker('cool', 'stuff')" )
180
+ "test_pytest_reserved_marker_skip_is_not_converted_to_allure_tag_example" ,
181
+ not_ (
182
+ has_tag ("skip(reason='reason')" )
183
+ )
100
184
)
101
185
)
102
186
103
187
104
- def test_pytest_marker_with_kwargs (allure_pytest_runner : AllurePytestRunner ):
188
+ def test_pytest_reserved_marker_skipif_is_not_converted_to_allure_tag (
189
+ allure_pytest_runner : AllurePytestRunner
190
+ ):
105
191
"""
106
192
>>> import pytest
107
193
108
- >>> @pytest.mark.marker(stuff='cool ')
109
- ... def test_pytest_marker_with_kwargs_example ():
194
+ >>> @pytest.mark.skipif(False, reason='reason ')
195
+ ... def test_pytest_reserved_marker_skipif_is_not_converted_to_allure_tag_example ():
110
196
... pass
111
197
"""
112
198
@@ -115,20 +201,22 @@ def test_pytest_marker_with_kwargs(allure_pytest_runner: AllurePytestRunner):
115
201
assert_that (
116
202
allure_results ,
117
203
has_test_case (
118
- "test_pytest_marker_with_kwargs_example" ,
119
- has_tag ("marker(stuff='cool')" )
204
+ "test_pytest_reserved_marker_skipif_is_not_converted_to_allure_tag_example" ,
205
+ not_ (
206
+ has_tag ("skipif(False, reason='reason')" )
207
+ )
120
208
)
121
209
)
122
210
123
211
124
- def test_pytest_marker_with_kwargs_native_encoding (
125
- allure_pytest_runner : AllurePytestRunner
212
+ def test_pytest_reserved_marker_xfail_is_not_converted_to_allure_tag (
213
+ allure_pytest_runner : AllurePytestRunner
126
214
):
127
215
"""
128
216
>>> import pytest
129
217
130
- >>> @pytest.mark.marker(stuff='я ')
131
- ... def test_pytest_marker_with_kwargs_native_encoding_example ():
218
+ >>> @pytest.mark.xfail(reason='this is unexpect pass ')
219
+ ... def test_pytest_reserved_marker_xfail_is_not_converted_to_allure_tag_example ():
132
220
... pass
133
221
"""
134
222
@@ -137,20 +225,47 @@ def test_pytest_marker_with_kwargs_native_encoding(
137
225
assert_that (
138
226
allure_results ,
139
227
has_test_case (
140
- "test_pytest_marker_with_kwargs_native_encoding_example" ,
141
- has_tag ("marker(stuff='я')" )
228
+ "test_pytest_reserved_marker_xfail_is_not_converted_to_allure_tag_example" ,
229
+ not_ (
230
+ has_tag ("xfail(reason='this is unexpect pass')" )
231
+ )
232
+ )
233
+ )
234
+
235
+
236
+ def test_pytest_reserved_marker_parametrize_is_not_converted_to_allure_tag (
237
+ allure_pytest_runner : AllurePytestRunner
238
+ ):
239
+ """
240
+ >>> import pytest
241
+
242
+ >>> @pytest.mark.parametrize("param", ["foo"])
243
+ ... def test_pytest_reserved_marker_parametrize_is_not_converted_to_allure_tag_example(param):
244
+ ... pass
245
+ """
246
+
247
+ allure_results = allure_pytest_runner .run_docstring ()
248
+
249
+ assert_that (
250
+ allure_results ,
251
+ has_test_case (
252
+ "test_pytest_reserved_marker_parametrize_is_not_converted_to_allure_tag_example[foo]" ,
253
+ not_ (
254
+ has_tag ("parametrize('param', ['foo'])" )
255
+ )
142
256
)
143
257
)
144
258
145
259
146
- def test_pytest_marker_with_kwargs_utf_encoding (
147
- allure_pytest_runner : AllurePytestRunner
260
+ def test_pytest_simple_markers_utf_encoding_are_converted_to_allure_tags (
261
+ allure_pytest_runner : AllurePytestRunner
148
262
):
149
263
"""
150
264
>>> import pytest
151
265
152
- >>> @pytest.mark.marker(stuff='я')
153
- ... def test_pytest_marker_with_kwargs_utf_encoding_example():
266
+ >>> @pytest.mark.классная
267
+ >>> @pytest.mark.штука
268
+ ... def test_pytest_simple_markers_utf_encoding_are_converted_to_allure_tags_example():
154
269
... pass
155
270
"""
156
271
@@ -159,7 +274,8 @@ def test_pytest_marker_with_kwargs_utf_encoding(
159
274
assert_that (
160
275
allure_results ,
161
276
has_test_case (
162
- "test_pytest_marker_with_kwargs_utf_encoding_example" ,
163
- has_tag ("marker(stuff='я')" )
277
+ "test_pytest_simple_markers_utf_encoding_are_converted_to_allure_tags_example" ,
278
+ has_tag ("классная" ),
279
+ has_tag ("штука" )
164
280
)
165
281
)
0 commit comments