Beispiel #1
0
def test_debug_no_args():
    """
    If the debugger is accidentally started with no filename and/or associated
    args, then emit a friendly message to indicate the problem.
    """
    mock_sys = mock.MagicMock()
    mock_sys.argv = [None]
    mock_print = mock.MagicMock()
    with mock.patch("mu.app.sys",
                    mock_sys), mock.patch("builtins.print", mock_print):
        debug()
    msg = "Debugger requires a Python script filename to run."
    mock_print.assert_called_once_with(msg)
Beispiel #2
0
def test_debug_no_args():
    """
    If the debugger is accidentally started with no filename and/or associated
    args, then emit a friendly message to indicate the problem.
    """
    mock_sys = mock.MagicMock()
    mock_sys.argv = [None, ]
    mock_print = mock.MagicMock()
    with mock.patch('mu.app.sys', mock_sys), \
            mock.patch('builtins.print', mock_print):
        debug()
    msg = "Debug runner requires a filename for a Python script to debug."
    mock_print.assert_called_once_with(msg)
Beispiel #3
0
def test_debug():
    """
    Ensure the debugger is run with the expected arguments given the filename
    and other arguments passed in via sys.argv.
    """
    mock_sys = mock.MagicMock()
    mock_sys.argv = [None, 'foo.py', 'foo', 'bar', 'baz']
    mock_runner = mock.MagicMock()
    with mock.patch('mu.app.sys', mock_sys), \
            mock.patch('mu.app.run_debugger', mock_runner):
        debug()
    expected_filename = os.path.normcase(os.path.abspath('foo.py'))
    mock_runner.assert_called_once_with('localhost', DEBUGGER_PORT,
                                        expected_filename,
                                        ['foo', 'bar', 'baz', ])
Beispiel #4
0
def test_debug():
    """
    Ensure the debugger is run with the expected arguments given the filename
    and other arguments passed in via sys.argv.
    """
    mock_sys = mock.MagicMock()
    mock_sys.argv = [None, "foo.py", "foo", "bar", "baz"]
    mock_runner = mock.MagicMock()
    with mock.patch("mu.app.sys",
                    mock_sys), mock.patch("mu.app.run_debugger", mock_runner):
        debug()
    expected_filename = os.path.normcase(os.path.abspath("foo.py"))
    mock_runner.assert_called_once_with("localhost", DEBUGGER_PORT,
                                        expected_filename,
                                        ["foo", "bar", "baz"])
Beispiel #5
0
def test_debug():
    """
    Ensure the debugger is run with the expected arguments given the filename
    and other arguments passed in via sys.argv.
    """
    mock_sys = mock.MagicMock()
    mock_sys.argv = [None, 'foo.py', 'foo', 'bar', 'baz']
    mock_runner = mock.MagicMock()
    with mock.patch('mu.app.sys', mock_sys), \
            mock.patch('mu.app.run_debugger', mock_runner):
        debug()
    expected_filename = os.path.normcase(os.path.abspath('foo.py'))
    mock_runner.assert_called_once_with('localhost', DEBUGGER_PORT,
                                        expected_filename,
                                        ['foo', 'bar', 'baz', ])
Beispiel #6
0
#!"C:\Program Files\Mu\Python\python.exe"
import sys, os
import site
installdir = os.path.dirname(os.path.dirname(__file__))
pkgdir = os.path.join(installdir, 'pkgs')
sys.path.insert(0, pkgdir)
# Ensure .pth files in pkgdir are handled properly
site.addsitedir(pkgdir)
os.environ['PYTHONPATH'] = pkgdir + os.pathsep + os.environ.get('PYTHONPATH', '')

# Allowing .dll files in Python directory to be found
os.environ['PATH'] += ';' + os.path.dirname(sys.executable)



if __name__ == '__main__':
    from mu.app import debug
    debug()
Beispiel #7
0
#!/usr/bin/env python3
from mu.app import debug


if __name__ == "__main__":
    debug()