def test_micropython_mode_port_path_unknown(): """ If the platform is unknown, raise NotImplementedError. """ editor = mock.MagicMock() view = mock.MagicMock() mm = MicroPythonMode(editor, view) with mock.patch('os.name', 'foo'): with pytest.raises(NotImplementedError): mm.port_path('bar')
def test_micropython_mode_port_path_unknown(): """ If the platform is unknown, raise NotImplementedError. """ editor = mock.MagicMock() view = mock.MagicMock() mm = MicroPythonMode(editor, view) with mock.patch('os.name', 'foo'): with pytest.raises(NotImplementedError): mm.port_path('bar')
def test_micropython_mode_port_path_nt(): """ Ensure the correct path for a port_name is returned if the platform is nt. """ editor = mock.MagicMock() view = mock.MagicMock() mm = MicroPythonMode(editor, view) with mock.patch('os.name', 'nt'): assert mm.port_path('COM0') == "COM0"
def test_micropython_mode_port_path_posix(): """ Ensure the correct path for a port_name is returned if the platform is posix. """ editor = mock.MagicMock() view = mock.MagicMock() mm = MicroPythonMode(editor, view) with mock.patch('os.name', 'posix'): assert mm.port_path('tty1') == "/dev/tty1"
def test_micropython_mode_port_path_nt(): """ Ensure the correct path for a port_name is returned if the platform is nt. """ editor = mock.MagicMock() view = mock.MagicMock() mm = MicroPythonMode(editor, view) with mock.patch('os.name', 'nt'): assert mm.port_path('COM0') == "COM0"
def test_micropython_mode_port_path_posix(): """ Ensure the correct path for a port_name is returned if the platform is posix. """ editor = mock.MagicMock() view = mock.MagicMock() mm = MicroPythonMode(editor, view) with mock.patch('os.name', 'posix'): assert mm.port_path('tty1') == "/dev/tty1"