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":
|
elif type == "bool":
|
||||||
return _strtobool(str(value).strip())
|
return _strtobool(str(value).strip())
|
||||||
else:
|
else:
|
||||||
assert type is None
|
assert type in [None, "string"]
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def _getconftest_pathlist(
|
def _getconftest_pathlist(
|
||||||
|
|
|
@ -570,11 +570,17 @@ class TestConfigAPI:
|
||||||
assert pl[0] == tmpdir
|
assert pl[0] == tmpdir
|
||||||
assert pl[1] == somepath
|
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(
|
testdir.makeconftest(
|
||||||
"""
|
f"""
|
||||||
def pytest_addoption(parser):
|
def pytest_addoption(parser):
|
||||||
parser.addini("myname", "my new ini value")
|
parser.addini("myname", "my new ini value"{type_string})
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
testdir.makeini(
|
testdir.makeini(
|
||||||
|
|
Loading…
Reference in New Issue