Beispiel #1
0
def test_setup_entry(reset_sys_argv):
    """Setup's entry is a bit different."""

    sys.argv = ["py-setup"]
    with mock.patch.object(commands, "get_config") as patched_config:
        commands.setup()
    patched_config.assert_called_once_with()
Beispiel #2
0
def test_setup_entry(reset_sys_argv):
    """Setup's entry is a bit different."""

    sys.argv = ["py-setup"]
    with mock.patch.object(commands, "get_config") as patched_config:
        commands.setup()
    patched_config.assert_called_once_with()
Beispiel #3
0
def test_setup_entry__location(reset_sys_argv):
    """Any additonal arguments should be treated as a filepath."""

    sys.argv = ["py-test", "somewhere/on/your/fs"]
    with mock.patch.object(commands, "get_config") as patched_config:
        commands.setup()

    patched_config.assert_called_once_with("somewhere/on/your/fs")
Beispiel #4
0
def test_setup_entry__version(reset_sys_argv, flag):
    """Ensure the VERSION static is raised with SystemExit when requested."""

    sys.argv = ["py-test", flag]
    with pytest.raises(SystemExit) as patched_exit:
        commands.setup()

    assert patched_exit.value.args[0] == pypackage.VERSION
Beispiel #5
0
def test_setup_entry__location(reset_sys_argv):
    """Any additonal arguments should be treated as a filepath."""

    sys.argv = ["py-test", "somewhere/on/your/fs"]
    with mock.patch.object(commands, "get_config") as patched_config:
        commands.setup()

    patched_config.assert_called_once_with("somewhere/on/your/fs")
Beispiel #6
0
def test_setup_entry__version(reset_sys_argv, flag):
    """Ensure the VERSION static is raised with SystemExit when requested."""

    sys.argv = ["py-test", flag]
    with pytest.raises(SystemExit) as patched_exit:
        commands.setup()

    assert patched_exit.value.args[0] == pypackage.VERSION
Beispiel #7
0
def test_setup_entry__multilocations(reset_sys_argv):
    """All additonal arguments should be treated as a filepath."""

    sys.argv = ["py-test", "place1", "place2"]
    with mock.patch.object(commands, "get_config") as patched_config:
        commands.setup()

    patched_config.assert_any_call("place1")
    patched_config.assert_any_call("place2")

    assert patched_config.call_count == 2
Beispiel #8
0
def test_setup_entry__help(reset_sys_argv, flag):
    """Ensure we get the docstring as exit help if the flag is set."""

    sys.argv = ["py-setup", flag]
    with pytest.raises(SystemExit) as patched_exit:
        commands.setup()

    for line in commands.setup.__doc__.splitlines():
        line = line.strip()
        if line:
            assert line in patched_exit.value.args[0]
Beispiel #9
0
def test_setup_entry__multilocations(reset_sys_argv):
    """All additonal arguments should be treated as a filepath."""

    sys.argv = ["py-test", "place1", "place2"]
    with mock.patch.object(commands, "get_config") as patched_config:
        commands.setup()

    patched_config.assert_any_call("place1")
    patched_config.assert_any_call("place2")

    assert patched_config.call_count == 2
Beispiel #10
0
def test_setup_entry__help(reset_sys_argv, flag):
    """Ensure we get the docstring as exit help if the flag is set."""

    sys.argv = ["py-setup", flag]
    with pytest.raises(SystemExit) as patched_exit:
        commands.setup()

    for line in commands.setup.__doc__.splitlines():
        line = line.strip()
        if line:
            assert line in patched_exit.value.args[0]