File tree 3 files changed +22
-2
lines changed 3 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -119,7 +119,9 @@ def pytest_cmdline_main(config):
119
119
config ._do_configure ()
120
120
tw = _pytest .config .create_terminal_writer (config )
121
121
for line in config .getini ("markers" ):
122
- name , rest = line .split (":" , 1 )
122
+ parts = line .split (":" , 1 )
123
+ name = parts [0 ]
124
+ rest = parts [1 ] if len (parts ) == 2 else ''
123
125
tw .write ("@pytest.mark.%s:" % name , bold = True )
124
126
tw .line (rest )
125
127
tw .line ()
@@ -272,7 +274,7 @@ def _check(self, name):
272
274
pass
273
275
self ._markers = values = set ()
274
276
for line in self ._config .getini ("markers" ):
275
- marker , _ = line .split (":" , 1 )
277
+ marker = line .split (":" , 1 )[ 0 ]
276
278
marker = marker .rstrip ()
277
279
x = marker .split ("(" , 1 )[0 ]
278
280
values .add (x )
Original file line number Diff line number Diff line change
1
+ Handle marks without description
Original file line number Diff line number Diff line change @@ -161,11 +161,13 @@ def test_markers_option(testdir):
161
161
markers =
162
162
a1: this is a webtest marker
163
163
a1some: another marker
164
+ nodescription
164
165
""" )
165
166
result = testdir .runpytest ("--markers" , )
166
167
result .stdout .fnmatch_lines ([
167
168
"*a1*this is a webtest*" ,
168
169
"*a1some*another marker" ,
170
+ "*nodescription*" ,
169
171
])
170
172
171
173
@@ -186,6 +188,21 @@ def test_markers():
186
188
rec .assertoutcome (passed = 1 )
187
189
188
190
191
+ def test_marker_without_description (testdir ):
192
+ testdir .makefile (".cfg" , setup = """
193
+ [tool:pytest]
194
+ markers=slow
195
+ """ )
196
+ testdir .makeconftest ("""
197
+ import pytest
198
+ pytest.mark.xfail('FAIL')
199
+ """ )
200
+ ftdir = testdir .mkdir ("ft1_dummy" )
201
+ testdir .tmpdir .join ("conftest.py" ).move (ftdir .join ("conftest.py" ))
202
+ rec = testdir .runpytest_subprocess ("--strict" )
203
+ rec .assert_outcomes ()
204
+
205
+
189
206
def test_markers_option_with_plugin_in_current_dir (testdir ):
190
207
testdir .makeconftest ('pytest_plugins = "flip_flop"' )
191
208
testdir .makepyfile (flip_flop = """\
You can’t perform that action at this time.
0 commit comments