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:
holger krekel
2010-10-30 19:23:50 +02:00
parent 2d8bcbdf55
commit 1280041f0c
6 changed files with 42 additions and 12 deletions

View File

@@ -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("""