Exemple #1
0
def test_add_fs_no_repl():
    """
    It's possible to add the file system pane if the REPL is inactive.
    """
    view = mock.MagicMock()
    editor = mock.MagicMock()
    mm = MicrobitMode(editor, view)
    with mock.patch('mu.modes.microbit.microfs.get_serial', return_value=True):
        mm.add_fs()
    workspace = mm.workspace_dir()
    view.add_filesystem.assert_called_once_with(home=workspace)
    assert mm.fs
Exemple #2
0
def test_add_fs():
    """
    It's possible to add the file system pane if the REPL is inactive.
    """
    view = mock.MagicMock()
    editor = mock.MagicMock()
    mm = MicrobitMode(editor, view)
    with mock.patch('mu.modes.microbit.FileManager') as mock_fm,\
            mock.patch('mu.modes.microbit.QThread'),\
            mock.patch('mu.modes.microbit.microfs.find_microbit',
                       return_value=True):
        mm.add_fs()
        workspace = mm.workspace_dir()
        view.add_filesystem.assert_called_once_with(workspace, mock_fm())
        assert mm.fs
Exemple #3
0
def test_add_fs(microbit):
    """
    It's possible to add the file system pane if the REPL is inactive.
    """
    view = mock.MagicMock()
    editor = mock.MagicMock()
    editor.current_device = microbit
    mm = MicrobitMode(editor, view)
    with mock.patch("mu.modes.microbit.FileManager") as mock_fm, mock.patch(
            "mu.modes.microbit.QThread"):
        mm.add_fs()
        workspace = mm.workspace_dir()
        view.add_filesystem.assert_called_once_with(workspace, mock_fm(),
                                                    "micro:bit")
        assert mm.fs
Exemple #4
0
def test_add_fs_no_repl():
    """
    It's possible to add the file system pane if the REPL is inactive.
    """
    view = mock.MagicMock()
    editor = mock.MagicMock()
    mm = MicrobitMode(editor, view)
    with mock.patch('mu.modes.microbit.FileManager') as mock_fm,\
            mock.patch('mu.modes.microbit.QThread'),\
            mock.patch('mu.modes.microbit.microfs.get_serial',
                       return_value=True):
        mm.add_fs()
        workspace = mm.workspace_dir()
        view.add_filesystem.assert_called_once_with(workspace, mock_fm())
        assert mm.fs