public void TestLaunchWithErrorsDontRun() { var app = new PythonVisualStudioApp(); var originalValue = GetOptions().PromptBeforeRunningWithBuildErrorSetting; GetOptions().PromptBeforeRunningWithBuildErrorSetting = true; try { var project = app.OpenProject(@"TestData\ErrorProject.sln"); var debug3 = (Debugger3)app.Dte.Debugger; ThreadPool.QueueUserWorkItem(x => debug3.Go(true)); var dialog = new PythonLaunchWithErrorsDialog(app.WaitForDialog()); dialog.No(); // make sure we don't go into debug mode for (int i = 0; i < 10; i++) { Assert.AreEqual(dbgDebugMode.dbgDesignMode, app.Dte.Debugger.CurrentMode); System.Threading.Thread.Sleep(100); } WaitForMode(app, dbgDebugMode.dbgDesignMode); } finally { GetOptions().PromptBeforeRunningWithBuildErrorSetting = originalValue; app.Dispose(); } }
/// <summary> /// Make sure the presence of errors causes F5 to prevent running w/o a confirmation. /// </summary> public void LaunchWithErrorsDontRun(PythonVisualStudioApp app, DotNotWaitOnNormalExit optionSetter) { using (new PythonDebuggingGeneralOptionsSetter(app.Dte, promptBeforeRunningWithBuildErrorSetting: true)) { var sln = app.CopyProjectForTest(@"TestData\ErrorProject.sln"); var project = app.OpenProject(sln); var projectDir = PathUtils.GetParent(project.FullName); // Open a file with errors string scriptFilePath = Path.Combine(projectDir, "Program.py"); app.Dte.ItemOperations.OpenFile(scriptFilePath); app.Dte.ExecuteCommand("View.ErrorList"); var items = app.WaitForErrorListItems(7); var debug3 = (Debugger3)app.Dte.Debugger; ThreadPool.QueueUserWorkItem(x => debug3.Go(true)); var dialog = new PythonLaunchWithErrorsDialog(app.WaitForDialog()); dialog.No(); // make sure we don't go into debug mode for (int i = 0; i < 10; i++) { Assert.AreEqual(dbgDebugMode.dbgDesignMode, app.Dte.Debugger.CurrentMode); System.Threading.Thread.Sleep(100); } WaitForMode(app, dbgDebugMode.dbgDesignMode); } }
public void TestLaunchWithErrorsDontRun() { var app = new PythonVisualStudioApp(); var originalValue = GetOptions().PromptBeforeRunningWithBuildErrorSetting; GetOptions().PromptBeforeRunningWithBuildErrorSetting = true; try { var project = app.OpenProject(@"TestData\ErrorProject.sln"); // Open a file with errors string scriptFilePath = TestData.GetPath(@"TestData\ErrorProject\Program.py"); app.Dte.ItemOperations.OpenFile(scriptFilePath); app.Dte.ExecuteCommand("View.ErrorList"); var items = app.WaitForErrorListItems(7); var debug3 = (Debugger3)app.Dte.Debugger; ThreadPool.QueueUserWorkItem(x => debug3.Go(true)); var dialog = new PythonLaunchWithErrorsDialog(app.WaitForDialog()); dialog.No(); // make sure we don't go into debug mode for (int i = 0; i < 10; i++) { Assert.AreEqual(dbgDebugMode.dbgDesignMode, app.Dte.Debugger.CurrentMode); System.Threading.Thread.Sleep(100); } WaitForMode(app, dbgDebugMode.dbgDesignMode); } finally { GetOptions().PromptBeforeRunningWithBuildErrorSetting = originalValue; app.Dispose(); } }
public void TestLaunchWithErrorsRun() { var project = DebugProject.OpenProject(@"Python.VS.TestData\ErrorProject.sln"); var app = new PythonVisualStudioApp(VsIdeTestHostContext.Dte); GetOptions().PromptBeforeRunningWithBuildErrorSetting = true; var debug3 = (Debugger3)VsIdeTestHostContext.Dte.Debugger; ThreadPool.QueueUserWorkItem(x => debug3.Go(true)); var dialog = new PythonLaunchWithErrorsDialog(app.WaitForDialog()); dialog.No(); // make sure we don't go into debug mode for (int i = 0; i < 10; i++) { Assert.AreEqual(VsIdeTestHostContext.Dte.Debugger.CurrentMode, dbgDebugMode.dbgDesignMode); System.Threading.Thread.Sleep(100); } WaitForMode(dbgDebugMode.dbgDesignMode); }