1- from hamcrest import assert_that , not_
1+ from hamcrest import assert_that , not_ , anything
22from tests .allure_pytest .pytest_runner import AllurePytestRunner
33
44from allure_commons_test .report import has_test_case
55from allure_commons_test .label import has_tag
66
77
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+ ):
911 """
1012 >>> import pytest
1113
1214 >>> @pytest.mark.cool
1315 ... @pytest.mark.stuff
14- ... def test_pytest_marker_example ():
16+ ... def test_pytest_simple_markers_are_converted_to_allure_tags_example ():
1517 ... pass
1618 """
1719
@@ -20,25 +22,21 @@ def test_pytest_marker(allure_pytest_runner: AllurePytestRunner):
2022 assert_that (
2123 allure_results ,
2224 has_test_case (
23- "test_pytest_marker_example " ,
25+ "test_pytest_simple_markers_are_converted_to_allure_tags_example " ,
2426 has_tag ("cool" ),
2527 has_tag ("stuff" )
2628 )
2729 )
2830
2931
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
3234):
3335 """
3436 >>> import pytest
3537
36- >>> @pytest.mark.usermark1
37- ... @pytest.mark.usermark2
38- ... @pytest.mark.parametrize("param", ["foo"])
39- ... @pytest.mark.skipif(False, reason="reason2")
40- ... @pytest.mark.skipif(False, reason="reason1")
41- ... def test_show_reserved_pytest_markers_full_decorator_example(param):
38+ >>> @pytest.mark.marker('cool', 'stuff')
39+ ... def test_pytest_marker_with_args_is_not_converted_to_allure_tag_example():
4240 ... pass
4341 """
4442
@@ -47,26 +45,46 @@ def test_show_reserved_pytest_markers_full_decorator(
4745 assert_that (
4846 allure_results ,
4947 has_test_case (
50- "test_show_reserved_pytest_markers_full_decorator_example[foo]" ,
51- has_tag ("usermark1" ),
52- has_tag ("usermark2" ),
53- has_tag ("@pytest.mark.skipif(False, reason='reason1')" ),
48+ "test_pytest_marker_with_args_is_not_converted_to_allure_tag_example" ,
5449 not_ (
55- has_tag ("@pytest.mark.skipif(False, reason='reason2')" )
56- ),
50+ has_tag (anything ())
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" ,
5773 not_ (
58- has_tag ("@pytest.mark.parametrize('param', ['foo'])" )
74+ has_tag (anything () )
5975 )
6076 )
6177 )
6278
6379
64- def test_pytest_xfail_marker (allure_pytest_runner : AllurePytestRunner ):
80+ def test_pytest_reserved_marker_usefixtures_is_not_converted_to_allure_tag (
81+ allure_pytest_runner : AllurePytestRunner
82+ ):
6583 """
6684 >>> import pytest
6785
68- >>> @pytest.mark.xfail(reason='this is unexpect pass ')
69- ... def test_pytest_xfail_marker_example ():
86+ >>> @pytest.mark.usefixtures('test_fixture ')
87+ ... def test_pytest_reserved_marker_usefixtures_is_not_converted_to_allure_tag_example ():
7088 ... pass
7189 """
7290
@@ -75,18 +93,22 @@ def test_pytest_xfail_marker(allure_pytest_runner: AllurePytestRunner):
7593 assert_that (
7694 allure_results ,
7795 has_test_case (
78- "test_pytest_xfail_marker_example" ,
79- has_tag ("@pytest.mark.xfail(reason='this is unexpect pass')" )
96+ "test_pytest_reserved_marker_usefixtures_is_not_converted_to_allure_tag_example" ,
97+ not_ (
98+ has_tag (anything ())
99+ )
80100 )
81101 )
82102
83103
84- def test_pytest_marker_with_args (allure_pytest_runner : AllurePytestRunner ):
104+ def test_pytest_reserved_marker_filterwarnings_is_not_converted_to_allure_tag (
105+ allure_pytest_runner : AllurePytestRunner
106+ ):
85107 """
86108 >>> import pytest
87109
88- >>> @pytest.mark.marker('cool', 'stuff ')
89- ... def test_pytest_marker_with_args_example ():
110+ >>> @pytest.mark.filterwarnings('ignore:val ')
111+ ... def test_pytest_reserved_marker_filterwarnings_is_not_converted_to_allure_tag_example ():
90112 ... pass
91113 """
92114
@@ -95,18 +117,22 @@ def test_pytest_marker_with_args(allure_pytest_runner: AllurePytestRunner):
95117 assert_that (
96118 allure_results ,
97119 has_test_case (
98- "test_pytest_marker_with_args_example" ,
99- has_tag ("marker('cool', 'stuff')" )
120+ "test_pytest_reserved_marker_filterwarnings_is_not_converted_to_allure_tag_example" ,
121+ not_ (
122+ has_tag (anything ())
123+ )
100124 )
101125 )
102126
103127
104- def test_pytest_marker_with_kwargs (allure_pytest_runner : AllurePytestRunner ):
128+ def test_pytest_reserved_marker_skip_is_not_converted_to_allure_tag (
129+ allure_pytest_runner : AllurePytestRunner
130+ ):
105131 """
106132 >>> import pytest
107133
108- >>> @pytest.mark.marker(stuff='cool ')
109- ... def test_pytest_marker_with_kwargs_example ():
134+ >>> @pytest.mark.skip(reason='reason ')
135+ ... def test_pytest_reserved_marker_skip_is_not_converted_to_allure_tag_example ():
110136 ... pass
111137 """
112138
@@ -115,20 +141,22 @@ def test_pytest_marker_with_kwargs(allure_pytest_runner: AllurePytestRunner):
115141 assert_that (
116142 allure_results ,
117143 has_test_case (
118- "test_pytest_marker_with_kwargs_example" ,
119- has_tag ("marker(stuff='cool')" )
144+ "test_pytest_reserved_marker_skip_is_not_converted_to_allure_tag_example" ,
145+ not_ (
146+ has_tag (anything ())
147+ )
120148 )
121149 )
122150
123151
124- def test_pytest_marker_with_kwargs_native_encoding (
125- allure_pytest_runner : AllurePytestRunner
152+ def test_pytest_reserved_marker_skipif_is_not_converted_to_allure_tag (
153+ allure_pytest_runner : AllurePytestRunner
126154):
127155 """
128156 >>> import pytest
129157
130- >>> @pytest.mark.marker(stuff='я ')
131- ... def test_pytest_marker_with_kwargs_native_encoding_example ():
158+ >>> @pytest.mark.skipif(False, reason='reason ')
159+ ... def test_pytest_reserved_marker_skipif_is_not_converted_to_allure_tag_example ():
132160 ... pass
133161 """
134162
@@ -137,20 +165,22 @@ def test_pytest_marker_with_kwargs_native_encoding(
137165 assert_that (
138166 allure_results ,
139167 has_test_case (
140- "test_pytest_marker_with_kwargs_native_encoding_example" ,
141- has_tag ("marker(stuff='я')" )
168+ "test_pytest_reserved_marker_skipif_is_not_converted_to_allure_tag_example" ,
169+ not_ (
170+ has_tag (anything ())
171+ )
142172 )
143173 )
144174
145175
146- def test_pytest_marker_with_kwargs_utf_encoding (
147- allure_pytest_runner : AllurePytestRunner
176+ def test_pytest_reserved_marker_xfail_is_not_converted_to_allure_tag (
177+ allure_pytest_runner : AllurePytestRunner
148178):
149179 """
150180 >>> import pytest
151181
152- >>> @pytest.mark.marker(stuff='я ')
153- ... def test_pytest_marker_with_kwargs_utf_encoding_example ():
182+ >>> @pytest.mark.xfail(reason='this is unexpect pass ')
183+ ... def test_pytest_reserved_marker_xfail_is_not_converted_to_allure_tag_example ():
154184 ... pass
155185 """
156186
@@ -159,7 +189,33 @@ def test_pytest_marker_with_kwargs_utf_encoding(
159189 assert_that (
160190 allure_results ,
161191 has_test_case (
162- "test_pytest_marker_with_kwargs_utf_encoding_example" ,
163- has_tag ("marker(stuff='я')" )
192+ "test_pytest_reserved_marker_xfail_is_not_converted_to_allure_tag_example" ,
193+ not_ (
194+ has_tag (anything ())
195+ )
196+ )
197+ )
198+
199+
200+ def test_pytest_reserved_marker_parametrize_is_not_converted_to_allure_tag (
201+ allure_pytest_runner : AllurePytestRunner
202+ ):
203+ """
204+ >>> import pytest
205+
206+ >>> @pytest.mark.parametrize("param", ["foo"])
207+ ... def test_pytest_reserved_marker_parametrize_is_not_converted_to_allure_tag_example(param):
208+ ... pass
209+ """
210+
211+ allure_results = allure_pytest_runner .run_docstring ()
212+
213+ assert_that (
214+ allure_results ,
215+ has_test_case (
216+ "test_pytest_reserved_marker_parametrize_is_not_converted_to_allure_tag_example[foo]" ,
217+ not_ (
218+ has_tag (anything ())
219+ )
164220 )
165221 )
0 commit comments