add and document new parser.addini(name, description) method to describe
ini-values. Also document the parser object with its public methods. --HG-- branch : trunk
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import py
|
||||
from pytest.plugin import config as parseopt
|
||||
from textwrap import dedent
|
||||
|
||||
class TestParser:
|
||||
def test_no_help_by_default(self, capsys):
|
||||
@@ -100,6 +101,18 @@ class TestParser:
|
||||
assert option.hello == "world"
|
||||
assert option.this == 42
|
||||
|
||||
def test_parser_addini(self, tmpdir):
|
||||
parser = parseopt.Parser()
|
||||
parser.addini("myname", "my new ini value")
|
||||
cfg = py.iniconfig.IniConfig("tox.ini", dedent("""
|
||||
[pytest]
|
||||
myname=hello
|
||||
"""))['pytest']
|
||||
class option:
|
||||
pass
|
||||
parser.setfromini(cfg, option)
|
||||
assert option.myname == "hello"
|
||||
|
||||
@py.test.mark.skipif("sys.version_info < (2,5)")
|
||||
def test_addoption_parser_epilog(testdir):
|
||||
testdir.makeconftest("""
|
||||
|
||||
Reference in New Issue
Block a user