Beispiel #1
0
def test_old_escdelay_persists(reset_sys_argv, simple_module):
    """Ensure any previously existing ESCDELAY envvar is reset on exit."""

    os.environ["ESCDELAY"] = "100"
    conf = Config()
    box = mock.Mock()
    box.pick = mock.Mock(return_value=None)

    with mock.patch.object(classified, "curses"):
        with mock.patch.object(classified, "BoxSelector", return_value=box):
            classified.choose_classifiers(conf)

    assert os.environ["ESCDELAY"] == "100"
Beispiel #2
0
def test_old_escdelay_persists(reset_sys_argv, simple_module):
    """Ensure any previously existing ESCDELAY envvar is reset on exit."""

    os.environ["ESCDELAY"] = "100"
    conf = Config()
    box = mock.Mock()
    box.pick = mock.Mock(return_value=None)

    with mock.patch.object(classified, "curses"):
        with mock.patch.object(classified, "BoxSelector", return_value=box):
            classified.choose_classifiers(conf)

    assert os.environ["ESCDELAY"] == "100"
Beispiel #3
0
def test_choose_classifiers(reset_sys_argv, simple_module):
    """Verify the logic in choosing classifiers."""

    os.environ.pop("ESCDELAY", None)
    conf = Config()
    box = mock.Mock()
    box.pick = mock.Mock(side_effect=iter([0, 4, 4, 4, 0, 9, 4, 3, 0, None]))

    with mock.patch.object(classified, "curses"):
        with mock.patch.object(classified, "BoxSelector", return_value=box):
            choices = classified.choose_classifiers(conf)

    assert choices == ["Development Status :: 4 - Beta"]
    assert "ESCDELAY" not in os.environ
Beispiel #4
0
def test_choose_classifiers(reset_sys_argv, simple_module):
    """Verify the logic in choosing classifiers."""

    os.environ.pop("ESCDELAY", None)
    conf = Config()
    box = mock.Mock()
    box.pick = mock.Mock(side_effect=iter([0, 4, 4, 4, 0, 9, 4, 3, 0, None]))

    with mock.patch.object(classified, "curses"):
        with mock.patch.object(classified, "BoxSelector", return_value=box):
            choices = classified.choose_classifiers(conf)

    assert choices == ["Development Status :: 4 - Beta"]
    assert "ESCDELAY" not in os.environ