示例#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')
    assert "".join(result) == textwrap.dedent("""\
        [toxx]
    """)
    assert ("Did not find [tox] section in tox.ini" in capsys.readouterr().err)
示例#2
0
def test_update_ini_setting_from_empty():
    source_lines = textwrap.dedent("""\
        [tox]
        envlist =
        usedevelop = true
    """).splitlines(True)
    result = update_ini_setting(source_lines, 'tox', 'envlist', 'py36,py37')
    assert "".join(result) == textwrap.dedent("""\
        [tox]
        envlist = py36,py37
        usedevelop = true
    """)
示例#3
0
def test_update_ini_setting_multiline_first_on_same_line():
    source_lines = textwrap.dedent("""\
        [tox]
        envlist = py26,
                  py27
        usedevelop = true
    """).splitlines(True)
    result = update_ini_setting(source_lines, 'tox', 'envlist', 'py36,\npy37')
    assert "".join(result) == textwrap.dedent("""\
        [tox]
        envlist = py36,
                  py37
        usedevelop = true
    """)
示例#4
0
def test_update_ini_setting_multiline_with_comments():
    source_lines = textwrap.dedent("""\
        [tox]
        envlist =
        # blah blah
        #   py26,py27,pypy
            py26,py27
        usedevelop = true
    """).splitlines(True)
    result = update_ini_setting(source_lines, 'tox', 'envlist', 'py36,py37')
    assert "".join(result) == textwrap.dedent("""\
        [tox]
        envlist =
        # blah blah
        #   py26,py27,pypy
            py36,py37
        usedevelop = true
    """)