Update tests to cover explicit None and "string" as addini() types
This commit is contained in:
parent
af3759a503
commit
76acb44330
|
@ -1402,7 +1402,7 @@ class Config:
|
|||
elif type == "bool":
|
||||
return _strtobool(str(value).strip())
|
||||
else:
|
||||
assert type is None
|
||||
assert type in [None, "string"]
|
||||
return value
|
||||
|
||||
def _getconftest_pathlist(
|
||||
|
|
|
@ -570,11 +570,17 @@ class TestConfigAPI:
|
|||
assert pl[0] == tmpdir
|
||||
assert pl[1] == somepath
|
||||
|
||||
def test_addini(self, testdir):
|
||||
@pytest.mark.parametrize("maybe_type", ["not passed", "None", '"string"'])
|
||||
def test_addini(self, testdir, maybe_type):
|
||||
if maybe_type == "not passed":
|
||||
type_string = ""
|
||||
else:
|
||||
type_string = f", {maybe_type}"
|
||||
|
||||
testdir.makeconftest(
|
||||
"""
|
||||
f"""
|
||||
def pytest_addoption(parser):
|
||||
parser.addini("myname", "my new ini value")
|
||||
parser.addini("myname", "my new ini value"{type_string})
|
||||
"""
|
||||
)
|
||||
testdir.makeini(
|
||||
|
|
Loading…
Reference in New Issue