sarugaku/vistir

test_spinner fails with colorama 0.3.3

jayvdb opened this issue · 2 comments

When colorama is 0.3.3, ...

__________________________ test_spinner[False-False] ___________________________

monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7fc2bb3d4550>
nospin = False, write_to_stdout = False

    @pytest.mark.parametrize("nospin, write_to_stdout", (
        (True, True), (True, False),
        (False, True), (False, False)
    ))
    def test_spinner(monkeypatch, nospin, write_to_stdout):
        with replaced_stream("stdout") as stdout:
            with replaced_stream("stderr") as stderr:
                with monkeypatch.context() as m:
                    # m.setenv("VISTIR_DISABLE_COLORS", "1")
                    import vistir.spin
                    with vistir.spin.create_spinner(
                        spinner_name="bouncingBar", text="Running...", nospin=nospin,
                        write_to_stdout=write_to_stdout
                    ) as spinner:
                        time.sleep(3)
                        spinner.ok("Ok!")
                    out = stdout.getvalue().strip(vistir.spin.CLEAR_LINE).strip()
                    err = stderr.getvalue().strip(vistir.spin.CLEAR_LINE).strip()
                    if write_to_stdout:
                        assert "Ok!" in out.strip().splitlines()[-1], out
                        assert err.strip() == "", err
                    else:
>                       assert "Ok!" in err.strip().splitlines()[-1], err
E                       IndexError: list index out of range

tests/test_spinner.py:30: IndexError

Probably a good idea to set minimums for the other dependencies, so vistir provides a stable and consistent baseline that other packages can rely on.

Sure, I’m surprised anyone is using versions of colorama that old. That’s like 2 years out of date