def setUp(self):
        super(SuperConsoleTest, self).setUp()

        import clr
        if is_netstandard:
            clr.AddReference("System.Diagnostics.Process")
            clr.AddReference("System.IO.FileSystem")

        #if this is a debug build and the assemblies are being saved...peverify is run.
        #for the test to pass, Maui assemblies must be in the AssembliesDir
        if is_peverify_run:
            AddReferenceToDlrCore()
            clr.AddReference("Microsoft.Scripting")
            from Microsoft.Scripting.Runtime import ScriptDomainManager
            from System.IO import Path

            tempMauiDir = Path.GetTempPath()

            print "Copying Maui.Core.dll to %s for peverify..." % (tempMauiDir)
            if not File.Exists(tempMauiDir + '\\Maui.Core.dll'):
                File.Copy(
                    testpath.rowan_root +
                    '\\Util\\Internal\\Maui_old\\Maui.Core.dll',
                    tempMauiDir + '\\Maui.Core.dll')

        #Cleanup the last run
        for t_name in ['ip_session.log', 'ip_session_stderr.log']:
            if File.Exists(t_name):
                File.Delete(t_name)
            Assert(not File.Exists(t_name))

        sys.path.append(testpath.rowan_root + '\\Util\\Internal\\Maui_old')
        try:
            clr.AddReference('Maui.Core.dll')
        except:
            print "test_superconsole.py failed: cannot load Maui.Core assembly"
            sys.exit(int(is_snap))

        from Maui.Core import App
        proc = Process()
        proc.StartInfo.FileName = sys.executable
        proc.StartInfo.WorkingDirectory = testpath.rowan_root + '\\Languages\\IronPython\\Tests'
        proc.StartInfo.Arguments = '-X:TabCompletion -X:AutoIndent -X:ColorfulConsole'
        proc.StartInfo.UseShellExecute = True
        proc.StartInfo.WindowStyle = ProcessWindowStyle.Normal
        proc.StartInfo.CreateNoWindow = False
        started = proc.Start()

        try:
            superConsole = App(proc.Id)
        except Exception as e:
            print "test_superconsole.py failed: cannot initialize App object (probably running as service, or in minimized remote window)"
            print "On VSLGO-MAUI machines close all remote desktop sessions using EXIT command on desktop!"
            proc.Kill()
            sys.exit(1)

        superConsole.SendKeys('from pretest import *{ENTER}')
示例#2
0
except:
    print "test_superconsole.py failed: cannot load Maui.Core assembly"
    sys.exit(int(is_snap))

from Maui.Core import App
proc = Process()
proc.StartInfo.FileName = sys.executable
proc.StartInfo.WorkingDirectory = testpath.rowan_root + '\\Languages\\IronPython\\Tests'
proc.StartInfo.Arguments = '-X:TabCompletion -X:AutoIndent -X:ColorfulConsole'
proc.StartInfo.UseShellExecute = True
proc.StartInfo.WindowStyle = ProcessWindowStyle.Normal
proc.StartInfo.CreateNoWindow = False
started = proc.Start()

try:
    superConsole = App(proc.Id)
except Exception as e:
    print "test_superconsole.py failed: cannot initialize App object (probably running as service, or in minimized remote window)"
    print "On VSLGO-MAUI machines close all remote desktop sessions using EXIT command on desktop!"
    proc.Kill()
    sys.exit(1)

superConsole.SendKeys('from pretest import *{ENTER}')


#------------------------------------------------------------------------------
#--Tests
def test_newlines():
    '''
    Ensure empty lines do not break the console.
    '''