File tree 3 files changed +21
-2
lines changed 3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -272,8 +272,9 @@ def _check(self, name):
272
272
pass
273
273
self ._markers = l = set ()
274
274
for line in self ._config .getini ("markers" ):
275
- beginning = line .split (":" , 1 )
276
- x = beginning [0 ].split ("(" , 1 )[0 ]
275
+ marker , _ = line .split (":" , 1 )
276
+ marker = marker .rstrip ()
277
+ x = marker .split ("(" , 1 )[0 ]
277
278
l .add (x )
278
279
if name not in self ._markers :
279
280
raise AttributeError ("%r not a registered marker" % (name ,))
Original file line number Diff line number Diff line change
1
+ Strip whitespace from marker names when reading them from INI config.
Original file line number Diff line number Diff line change @@ -169,6 +169,23 @@ def test_markers_option(testdir):
169
169
])
170
170
171
171
172
+ def test_ini_markers_whitespace (testdir ):
173
+ testdir .makeini ("""
174
+ [pytest]
175
+ markers =
176
+ a1 : this is a whitespace marker
177
+ """ )
178
+ testdir .makepyfile ("""
179
+ import pytest
180
+
181
+ @pytest.mark.a1
182
+ def test_markers():
183
+ assert True
184
+ """ )
185
+ rec = testdir .inline_run ("--strict" , "-m" , "a1" )
186
+ rec .assertoutcome (passed = 1 )
187
+
188
+
172
189
def test_markers_option_with_plugin_in_current_dir (testdir ):
173
190
testdir .makeconftest ('pytest_plugins = "flip_flop"' )
174
191
testdir .makepyfile (flip_flop = """\
You can’t perform that action at this time.
0 commit comments