示例#1
0
        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);
            }
        }
示例#2
0
        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);
            }
        }