Merge pull request #2867 from Perlence/ini-markers-whitespace
Strip whitespace from markers in INI config
This commit is contained in:
commit
bdab29fa3d
|
@ -272,8 +272,9 @@ class MarkGenerator:
|
|||
pass
|
||||
self._markers = l = set()
|
||||
for line in self._config.getini("markers"):
|
||||
beginning = line.split(":", 1)
|
||||
x = beginning[0].split("(", 1)[0]
|
||||
marker, _ = line.split(":", 1)
|
||||
marker = marker.rstrip()
|
||||
x = marker.split("(", 1)[0]
|
||||
l.add(x)
|
||||
if name not in self._markers:
|
||||
raise AttributeError("%r not a registered marker" % (name,))
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Strip whitespace from marker names when reading them from INI config.
|
|
@ -169,6 +169,23 @@ def test_markers_option(testdir):
|
|||
])
|
||||
|
||||
|
||||
def test_ini_markers_whitespace(testdir):
|
||||
testdir.makeini("""
|
||||
[pytest]
|
||||
markers =
|
||||
a1 : this is a whitespace marker
|
||||
""")
|
||||
testdir.makepyfile("""
|
||||
import pytest
|
||||
|
||||
@pytest.mark.a1
|
||||
def test_markers():
|
||||
assert True
|
||||
""")
|
||||
rec = testdir.inline_run("--strict", "-m", "a1")
|
||||
rec.assertoutcome(passed=1)
|
||||
|
||||
|
||||
def test_markers_option_with_plugin_in_current_dir(testdir):
|
||||
testdir.makeconftest('pytest_plugins = "flip_flop"')
|
||||
testdir.makepyfile(flip_flop="""\
|
||||
|
|
Loading…
Reference in New Issue