Ejemplo n.º 1
0
def test_update_ini_setting_no_section(capsys):
    source_lines = textwrap.dedent("""\
        [toxx]
    """).splitlines(True)
    result = update_ini_setting(source_lines,
                                'tox',
                                'envlist',
                                'py36,py37',
                                filename='tox.ini')
    assert "".join(result) == textwrap.dedent("""\
        [toxx]
    """)
    assert ("Did not find [tox] section in tox.ini" in capsys.readouterr().err)
Ejemplo n.º 2
0
def test_update_ini_setting():
    source_lines = textwrap.dedent("""\
        [tox]
        envlist = py26,py27
        usedevelop = true
    """).splitlines(True)
    result = update_ini_setting(source_lines,
                                'tox',
                                'envlist',
                                'py36,py37',
                                filename='tox.ini')
    assert "".join(result) == textwrap.dedent("""\
        [tox]
        envlist = py36,py37
        usedevelop = true
    """)
Ejemplo n.º 3
0
def test_update_ini_setting_multiline_with_comments():
    source_lines = textwrap.dedent("""\
        [tox]
        envlist =
        # blah blah
        #   py26,py27,pypy
            py26,py27
        # etc.
        usedevelop = true
    """).splitlines(True)
    result = update_ini_setting(source_lines,
                                'tox',
                                'envlist',
                                'py36,py37',
                                filename='tox.ini')
    assert "".join(result) == textwrap.dedent("""\
        [tox]
        envlist =
        # blah blah
        #   py26,py27,pypy
            py36,py37
        # etc.
        usedevelop = true
    """)