Exemplo n.º 1
0
def test_parallel_execute_noansi(capsys):
    ParallelStreamWriter.set_noansi()
    results, errors = parallel_execute(
        objects=["something", "something more"],
        func=lambda x: x,
        get_name=six.text_type,
        msg="Control characters",
    )

    assert errors == {}

    _, err = capsys.readouterr()
    assert "\x1b" not in err
Exemplo n.º 2
0
def test_parallel_execute_alignment_noansi(capsys):
    ParallelStreamWriter.set_noansi()
    results, errors = parallel_execute(
        objects=["short", "a very long name"],
        func=lambda x: x,
        get_name=six.text_type,
        msg="Aligning",
    )

    assert errors == {}

    _, err = capsys.readouterr()
    a, b, c, d = err.split('\n')[:4]
    assert a.index('...') == b.index('...') == c.index('...') == d.index('...')
Exemplo n.º 3
0
def test_parallel_execute_ansi(capsys):
    ParallelStreamWriter.instance = None
    ParallelStreamWriter.set_noansi(value=False)
    results, errors = parallel_execute(
        objects=["something", "something more"],
        func=lambda x: x,
        get_name=str,
        msg="Control characters",
    )

    assert errors == {}

    _, err = capsys.readouterr()
    assert "\x1b" in err
Exemplo n.º 4
0
def test_parallel_execute_alignment_noansi(capsys):
    ParallelStreamWriter.set_noansi()
    results, errors = parallel_execute(
        objects=["short", "a very long name"],
        func=lambda x: x,
        get_name=six.text_type,
        msg="Aligning",
    )

    assert errors == {}

    _, err = capsys.readouterr()
    a, b, c, d = err.split('\n')[:4]
    assert a.index('...') == b.index('...') == c.index('...') == d.index('...')