Ejemplo n.º 1
0
        public void LaunchPythonProfilingWizard()
        {
            var app     = new PythonVisualStudioApp(VsIdeTestHostContext.Dte);
            var project = DebugProject.OpenProject(@"Python.VS.TestData\ProfileTest.sln");

            app.LaunchPythonProfiling();

            // wait for the dialog, set some settings, save them.
            var perfTarget = new PythonPerfTarget(app.WaitForDialog());

            perfTarget.SelectProfileProject();

            perfTarget.SelectedProjectComboBox.SelectItem("HelloWorld");

            perfTarget.Ok();
            app.WaitForDialogDismissed();

            var profiling = (IPythonProfiling)VsIdeTestHostContext.Dte.GetObject("PythonProfiling");
            var session   = profiling.GetSession(1);

            try {
                Assert.AreNotEqual(null, app.PythonPerformanceExplorerTreeView.WaitForItem("HelloWorld *"));

                while (profiling.IsProfiling)
                {
                    // wait for profiling to finish...
                    System.Threading.Thread.Sleep(100);
                }
            } finally {
                profiling.RemoveSession(session, true);
            }
        }
Ejemplo n.º 2
0
        public void NewProfilingSession()
        {
            VsIdeTestHostContext.Dte.Solution.Close(false);

            var app = new PythonVisualStudioApp(VsIdeTestHostContext.Dte);

            app.PythonPerformanceExplorerToolBar.NewPerfSession();

            var profiling = (IPythonProfiling)VsIdeTestHostContext.Dte.GetObject("PythonProfiling");

            app.OpenPythonPerformance();
            var perf = app.PythonPerformanceExplorerTreeView.WaitForItem("Performance *");

            Debug.Assert(perf != null);
            var session = profiling.GetSession(1);

            Assert.AreNotEqual(session, null);

            try {
                Mouse.MoveTo(perf.GetClickablePoint());
                Mouse.DoubleClick(System.Windows.Input.MouseButton.Left);

                // wait for the dialog, set some settings, save them.
                var perfTarget = new PythonPerfTarget(app.WaitForDialog());

                perfTarget.SelectProfileScript();

                perfTarget.InterpreterComboBox.SelectItem("Python 2.6");
                perfTarget.ScriptName = Path.GetFullPath(@"Python.VS.TestData\ProfileTest\Program.py");

                perfTarget.Ok();
                app.WaitForDialogDismissed();

                Mouse.MoveTo(perf.GetClickablePoint());
                Mouse.DoubleClick(System.Windows.Input.MouseButton.Left);

                // re-open the dialog, verify the settings
                perfTarget = new PythonPerfTarget(app.WaitForDialog());

                Assert.AreEqual("Python 2.6", perfTarget.SelectedInterpreter);
                Assert.AreEqual(Path.GetFullPath(@"Python.VS.TestData\ProfileTest\Program.py"), perfTarget.ScriptName);

                perfTarget.Ok();
            } finally {
                profiling.RemoveSession(session, true);
            }
        }
Ejemplo n.º 3
0
        public void NewProfilingSessionOpenSolution()
        {
            var app     = new PythonVisualStudioApp(VsIdeTestHostContext.Dte);
            var project = DebugProject.OpenProject(@"Python.VS.TestData\ProfileTest.sln");

            app.PythonPerformanceExplorerToolBar.NewPerfSession();

            var profiling = (IPythonProfiling)VsIdeTestHostContext.Dte.GetObject("PythonProfiling");

            var perf = app.PythonPerformanceExplorerTreeView.WaitForItem("Performance");

            var session = profiling.GetSession(1);

            Assert.AreNotEqual(session, null);

            try {
                Mouse.MoveTo(perf.GetClickablePoint());
                Mouse.DoubleClick(System.Windows.Input.MouseButton.Left);

                // wait for the dialog, set some settings, save them.
                var perfTarget = new PythonPerfTarget(app.WaitForDialog());

                perfTarget.SelectProfileProject();

                perfTarget.SelectedProjectComboBox.SelectItem("HelloWorld");

                perfTarget.Ok();
                app.WaitForDialogDismissed();

                Mouse.MoveTo(perf.GetClickablePoint());
                Mouse.DoubleClick(System.Windows.Input.MouseButton.Left);

                // re-open the dialog, verify the settings
                perfTarget = new PythonPerfTarget(app.WaitForDialog());

                Assert.AreEqual("HelloWorld", perfTarget.SelectedProject);

                perfTarget.Ok();
            } finally {
                profiling.RemoveSession(session, true);
            }
        }