Ejemplo n.º 1
0
def test_main(files_mock, sys_mock, *args):
    # So the checkers mock supports iteration.
    mock = Mock()
    Mock.__iter__ = lambda *args: iter([mock])

    files = ["foo", "bar"]
    files_mock.return_value = files
    sys_mock.argv = [Mock()]

    check._main()

    mock.assert_called_with(files)
Ejemplo n.º 2
0
def test_main(files_mock, sys_mock, *args):
    # So the checkers mock supports iteration.
    mock = Mock()
    Mock.__iter__ = lambda *args: iter([mock])

    files = ['foo', 'bar']
    files_mock.return_value = files
    sys_mock.argv = [Mock()]

    check._main()

    mock.assert_called_with(files)
Ejemplo n.º 3
0
def test_main_with_args(sys_mock, isfile_mock, walkfiles_mock, *args):
    # So the checkers mock supports iteration.
    mock = Mock()
    Mock.__iter__ = lambda *args: iter([mock])

    sys_mock.argv = ["./check", "foo", "bar"]
    isfile_mock.return_value = True
    check._main()
    mock.assert_called_with(["foo", "bar"])

    mock.reset()
    isfile_mock.return_value = False
    walkfiles_mock.return_value = ["bar~", "bla.py"]
    check._main()
    mock.assert_called_with(["bla.py"])
Ejemplo n.º 4
0
def test_main_with_args(sys_mock, isfile_mock, walkfiles_mock, *args):
    # So the checkers mock supports iteration.
    mock = Mock()
    Mock.__iter__ = lambda *args: iter([mock])

    sys_mock.argv = ['./check', 'foo', 'bar']
    isfile_mock.return_value = True
    check._main()
    mock.assert_called_with(['foo', 'bar'])

    mock.reset()
    isfile_mock.return_value = False
    walkfiles_mock.return_value = ['bar~', 'bla.py']
    check._main()
    mock.assert_called_with(['bla.py'])