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); } }
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); } }
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); } }
public void TestTargetPropertiesForExecutable() { var profiling = (IPythonProfiling)VsIdeTestHostContext.Dte.GetObject("PythonProfiling"); // no sessions yet Assert.AreEqual(profiling.GetSession(1), null); var session = profiling.LaunchProcess("C:\\Python26\\python.exe", Path.GetFullPath(@"Python.VS.TestData\ProfileTest\Program.py"), Path.GetFullPath(@"Python.VS.TestData\ProfileTest"), "", false ); try { while (profiling.IsProfiling) { System.Threading.Thread.Sleep(100); } var app = new PythonVisualStudioApp(VsIdeTestHostContext.Dte); app.OpenPythonPerformance(); var pyPerf = app.PythonPerformanceExplorerTreeView; var item = pyPerf.FindItem("Program *"); Mouse.MoveTo(item.GetClickablePoint()); Mouse.DoubleClick(System.Windows.Input.MouseButton.Left); var perfTarget = new PythonPerfTarget(app.WaitForDialog()); Assert.AreEqual("C:\\Python26\\python.exe", perfTarget.EnteredInterpreter); Assert.AreEqual("", perfTarget.Arguments); Assert.IsTrue(perfTarget.ScriptName.EndsWith("Program.py")); Assert.IsTrue(perfTarget.ScriptName.StartsWith(perfTarget.WorkingDir)); perfTarget.Cancel(); app.WaitForDialogDismissed(); } finally { profiling.RemoveSession(session, true); } }
public void TestTargetPropertiesForProject() { var profiling = (IPythonProfiling)VsIdeTestHostContext.Dte.GetObject("PythonProfiling"); // no sessions yet Assert.AreEqual(profiling.GetSession(1), null); var project = DebugProject.OpenProject(@"Python.VS.TestData\ProfileTest.sln"); var session = profiling.LaunchProject(project, false); try { while (profiling.IsProfiling) { System.Threading.Thread.Sleep(100); } var app = new PythonVisualStudioApp(VsIdeTestHostContext.Dte); app.OpenPythonPerformance(); var pyPerf = app.PythonPerformanceExplorerTreeView; var item = pyPerf.FindItem("HelloWorld *"); Mouse.MoveTo(item.GetClickablePoint()); Mouse.DoubleClick(System.Windows.Input.MouseButton.Left); var perfTarget = new PythonPerfTarget(app.WaitForDialog()); Assert.AreEqual("HelloWorld", perfTarget.SelectedProject); perfTarget.Cancel(); app.WaitForDialogDismissed(); } finally { profiling.RemoveSession(session, true); } }