Exemplo n.º 1
0
        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();
            }
        }
Exemplo n.º 2
0
        /// <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);
            }
        }
Exemplo n.º 3
0
        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();
            }
        }
Exemplo n.º 4
0
        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);
        }