diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/PythonBinding.addin b/src/AddIns/BackendBindings/Python/PythonBinding/Project/PythonBinding.addin
index 38d677200f..061f7ef323 100644
--- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/PythonBinding.addin
+++ b/src/AddIns/BackendBindings/Python/PythonBinding/Project/PythonBinding.addin
@@ -55,21 +55,23 @@
insertbefore="Tools"
label="&Python"
type="Menu">
-
-
-
-
+
-
-
+
+
+
+ icon="Icons.16x16.StopProcess"
+ class="ICSharpCode.SharpDevelop.Project.Commands.StopDebuggingCommand"
+ label="${res:XML.MainMenu.DebugMenu.Stop}"/>
diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/PythonBinding.csproj b/src/AddIns/BackendBindings/Python/PythonBinding/Project/PythonBinding.csproj
index 6580e9b3ff..419e0286d2 100644
--- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/PythonBinding.csproj
+++ b/src/AddIns/BackendBindings/Python/PythonBinding/Project/PythonBinding.csproj
@@ -74,7 +74,6 @@
-
@@ -110,9 +109,9 @@
+
-
diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/IsPythonRunningCondition.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/IsPythonRunningCondition.cs
deleted file mode 100644
index 753875ac81..0000000000
--- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/IsPythonRunningCondition.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-//
-//
-//
-//
-// $Revision$
-//
-
-using System;
-using ICSharpCode.Core;
-
-namespace ICSharpCode.PythonBinding
-{
- ///
- /// Indicates whether the python console is running.
- ///
- public class IsPythonRunningCondition : IConditionEvaluator
- {
- public bool IsValid(object caller, Condition condition)
- {
- return RunPythonCommand.IsRunning;
- }
- }
-}
diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/StopPythonCommand.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/RunDebugPythonCommand.cs
similarity index 50%
rename from src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/StopPythonCommand.cs
rename to src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/RunDebugPythonCommand.cs
index 79e5fad249..d731d0eea9 100644
--- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/StopPythonCommand.cs
+++ b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/RunDebugPythonCommand.cs
@@ -1,4 +1,4 @@
-//
+//
//
//
//
@@ -7,26 +7,23 @@
using System;
using ICSharpCode.Core;
+using ICSharpCode.SharpDevelop.Debugging;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Util;
namespace ICSharpCode.PythonBinding
{
- ///
- /// Stops the Python console that is currently running.
- ///
- public class StopPythonCommand : AbstractMenuCommand
+ public class RunDebugPythonCommand : RunPythonCommand
{
- public StopPythonCommand()
+ public RunDebugPythonCommand(IWorkbench workbench, AddInOptions options, IDebugger debugger)
+ : base(workbench, options, debugger)
{
+ Debug = true;
}
- public override void Run()
+ public RunDebugPythonCommand()
+ : this(WorkbenchSingleton.Workbench, new AddInOptions(), DebuggerService.CurrentDebugger)
{
- RunPythonCommand runCommand = RunPythonCommand.RunningCommand;
- if (runCommand != null) {
- runCommand.Stop();
- }
}
}
}
diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/RunPythonCommand.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/RunPythonCommand.cs
index 38fa3a33e8..b962b15407 100644
--- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/RunPythonCommand.cs
+++ b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/RunPythonCommand.cs
@@ -6,7 +6,9 @@
//
using System;
+using System.Diagnostics;
using ICSharpCode.Core;
+using ICSharpCode.SharpDevelop.Debugging;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Util;
@@ -18,116 +20,55 @@ namespace ICSharpCode.PythonBinding
///
public class RunPythonCommand : AbstractMenuCommand
{
- IProcessRunner processRunner;
+ IDebugger debugger;
AddInOptions options;
IWorkbench workbench;
- MessageViewCategory category;
- IPadDescriptor outputWindowPad;
- static MessageViewCategory categorySingleton;
- static RunPythonCommand runningCommand;
+ bool debug;
public RunPythonCommand()
- : this(WorkbenchSingleton.Workbench, new AddInOptions(), new PythonProcessRunner(), PythonMessageViewCategory, new PythonOutputWindowPadDescriptor())
+ : this(WorkbenchSingleton.Workbench, new AddInOptions(), DebuggerService.CurrentDebugger)
{
}
- public RunPythonCommand(IWorkbench workbench, AddInOptions options, IProcessRunner processRunner, MessageViewCategory category, IPadDescriptor outputWindowPad)
+ public RunPythonCommand(IWorkbench workbench, AddInOptions options, IDebugger debugger)
{
- this.processRunner = processRunner;
- this.options = options;
this.workbench = workbench;
- this.category = category;
- this.outputWindowPad = outputWindowPad;
-
- processRunner.OutputLineReceived += OutputLineReceived;
- processRunner.ProcessExited += ProcessExited;
+ this.debugger = debugger;
+ this.options = options;
}
- ///
- /// Indicates whether the command is still running.
- ///
- public static bool IsRunning {
- get {
- return runningCommand != null;
- }
+ public bool Debug {
+ get { return debug; }
+ set { debug = value; }
}
- ///
- /// Gets the command that is currently running.
- ///
- public static RunPythonCommand RunningCommand {
- get {
- return runningCommand;
- }
- }
-
- ///
- /// Runs the python console passing the filename to the currently
- /// active python script.
- ///
public override void Run()
{
- // Get the python script filename.
- string fileName = workbench.ActiveWorkbenchWindow.ActiveViewContent.PrimaryFileName;
-
- // Clear the output window.
- outputWindowPad.BringPadToFront();
- category.ClearText();
-
- // Start the python console app passing the python script filename.
- CategoryWriteLine("Running Python...");
- string args = String.Concat('\"', fileName, '\"');
- CategoryWriteLine(String.Concat(options.PythonFileName, " ", args));
- processRunner.Start(options.PythonFileName, args);
-
- runningCommand = this;
- }
-
- ///
- /// Stops the python console.
- ///
- public void Stop()
- {
- if (runningCommand != null) {
- runningCommand = null;
- processRunner.Kill();
- }
- }
-
- ///
- /// Creates the single instance of the
- ///
- static MessageViewCategory PythonMessageViewCategory {
- get {
- if (categorySingleton == null) {
- MessageViewCategory.Create(ref categorySingleton, "Python");
- }
- return categorySingleton;
+ if (debug) {
+ debugger.Start(CreateProcessStartInfo());
+ } else {
+ debugger.StartWithoutDebugging(CreateProcessStartInfo());
}
}
- ///
- /// Handler for the ProcessRunner's output line received event.
- ///
- void OutputLineReceived(object source, LineReceivedEventArgs e)
+ ProcessStartInfo CreateProcessStartInfo()
{
- CategoryWriteLine(e.Line);
+ ProcessStartInfo info = new ProcessStartInfo();
+ info.FileName = options.PythonFileName;
+ info.Arguments = GetArguments();
+
+ return info;
}
- ///
- /// Handler for the process exit event.
- ///
- void ProcessExited(object source, EventArgs e)
+ string GetArguments()
{
- runningCommand = null;
+ // Get the python script filename.
+ string pythonScriptFileName = "\"" + workbench.ActiveWorkbenchWindow.ActiveViewContent.PrimaryFileName + "\"";
+
+ if (Debug) {
+ return "-D " + pythonScriptFileName;
+ }
+ return pythonScriptFileName;
}
-
- ///
- /// Writes a line of text to the output window.
- ///
- void CategoryWriteLine(string message)
- {
- category.AppendText(String.Concat(message, Environment.NewLine));
- }
}
}
diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/AddInFileTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/AddInFileTestFixture.cs
index 5e7540afbd..71889b8c85 100644
--- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/AddInFileTestFixture.cs
+++ b/src/AddIns/BackendBindings/Python/PythonBinding/Test/AddInFileTestFixture.cs
@@ -28,6 +28,7 @@ namespace PythonBinding.Tests
Codon fileFilterCodon;
Codon pythonMenuCodon;
Codon pythonRunMenuItemCodon;
+ Codon pythonWithoutDebuggerRunMenuItemCodon;
Codon pythonStopMenuItemCodon;
Codon fileTemplatesCodon;
Codon optionsPanelCodon;
@@ -63,6 +64,7 @@ namespace PythonBinding.Tests
const string runMenuExtensionPath = "/SharpDevelop/Workbench/MainMenu/Python";
pythonRunMenuItemCodon = GetCodon(runMenuExtensionPath, "Run");
+ pythonWithoutDebuggerRunMenuItemCodon = GetCodon(runMenuExtensionPath, "RunWithoutDebugger");
pythonStopMenuItemCodon = GetCodon(runMenuExtensionPath, "Stop");
fileTemplatesCodon = GetCodon("/SharpDevelop/BackendBindings/Templates", "Python");
@@ -232,7 +234,7 @@ namespace PythonBinding.Tests
[Test]
public void PythonStopMenuItemLabel()
{
- Assert.AreEqual("&Stop", pythonStopMenuItemCodon["label"]);
+ Assert.AreEqual("${res:XML.MainMenu.DebugMenu.Stop}", pythonStopMenuItemCodon["label"]);
}
[Test]
@@ -244,19 +246,19 @@ namespace PythonBinding.Tests
[Test]
public void PythonStopMenuItemClass()
{
- Assert.AreEqual("ICSharpCode.PythonBinding.StopPythonCommand", pythonStopMenuItemCodon["class"]);
+ Assert.AreEqual("ICSharpCode.SharpDevelop.Project.Commands.StopDebuggingCommand", pythonStopMenuItemCodon["class"]);
}
[Test]
public void PythonStopMenuItemIcon()
{
- Assert.AreEqual("Icons.16x16.Debug.StopProcess", pythonStopMenuItemCodon["icon"]);
+ Assert.AreEqual("Icons.16x16.StopProcess", pythonStopMenuItemCodon["icon"]);
}
[Test]
public void PythonRunMenuItemLabel()
{
- Assert.AreEqual("&Run", pythonRunMenuItemCodon["label"]);
+ Assert.AreEqual("${res:XML.MainMenu.RunMenu.Run}", pythonRunMenuItemCodon["label"]);
}
[Test]
@@ -268,7 +270,7 @@ namespace PythonBinding.Tests
[Test]
public void PythonRunMenuItemClass()
{
- Assert.AreEqual("ICSharpCode.PythonBinding.RunPythonCommand", pythonRunMenuItemCodon["class"]);
+ Assert.AreEqual("ICSharpCode.PythonBinding.RunDebugPythonCommand", pythonRunMenuItemCodon["class"]);
}
[Test]
@@ -290,26 +292,26 @@ namespace PythonBinding.Tests
}
[Test]
- public void PythonRunMenuNotConditionExists()
+ public void PythonRunMenuConditionName()
{
- NegatedCondition notCondition = pythonRunMenuItemCodon.Conditions[0] as NegatedCondition;
- Assert.IsNotNull(notCondition);
+ Condition condition = pythonRunMenuItemCodon.Conditions[0] as Condition;
+ Assert.IsNotNull("IsProcessRunning", condition.Name);
}
[Test]
- public void PythonRunMenuNotCondition()
+ public void PythonRunMenuConditionIsDebuggingProperty()
{
- NegatedCondition notCondition = pythonRunMenuItemCodon.Conditions[0] as NegatedCondition;
-
- // Use reflection to get the ICondition associated with the not
- // condition.
- Type type = notCondition.GetType();
- FieldInfo fieldInfo = type.GetField("condition", BindingFlags.NonPublic | BindingFlags.Instance);
- ICondition condition = fieldInfo.GetValue(notCondition) as ICondition;
-
- Assert.AreEqual("IsPythonRunning", condition.Name);
+ Condition condition = pythonRunMenuItemCodon.Conditions[0] as Condition;
+ Assert.AreEqual("False", condition["isdebugging"]);
}
+ [Test]
+ public void PythonRunMenuConditionIsProcessRunningProperty()
+ {
+ Condition condition = pythonRunMenuItemCodon.Conditions[0] as Condition;
+ Assert.AreEqual("False", condition["isprocessrunning"]);
+ }
+
[Test]
public void PythonRunMenuConditionAction()
{
@@ -318,17 +320,30 @@ namespace PythonBinding.Tests
}
[Test]
- public void PythonStopMenuConditionAction()
+ public void PythonStopMenuHasSingleCondition()
{
- ICondition condition = pythonStopMenuItemCodon.Conditions[0];
- Assert.AreEqual(ConditionFailedAction.Disable, condition.Action);
+ Assert.AreEqual(1, pythonStopMenuItemCodon.Conditions.Length);
}
[Test]
public void PythonStopMenuConditionName()
+ {
+ Condition condition = pythonStopMenuItemCodon.Conditions[0] as Condition;
+ Assert.IsNotNull("IsProcessRunning", condition.Name);
+ }
+
+ [Test]
+ public void PythonStopMenuConditionIsDebuggingProperty()
+ {
+ Condition condition = pythonStopMenuItemCodon.Conditions[0] as Condition;
+ Assert.AreEqual("True", condition["isdebugging"]);
+ }
+
+ [Test]
+ public void PythonStopMenuConditionAction()
{
ICondition condition = pythonStopMenuItemCodon.Conditions[0];
- Assert.AreEqual("IsPythonRunning", condition.Name);
+ Assert.AreEqual(ConditionFailedAction.Disable, condition.Action);
}
[Test]
@@ -704,6 +719,48 @@ namespace PythonBinding.Tests
Condition condition = convertVBNetProjectCodon.Conditions[0] as Condition;
Assert.AreEqual("VBNet", condition["activeproject"]);
}
+
+ [Test]
+ public void PythonRunWithoutDebuggerMenuItemLabel()
+ {
+ Assert.AreEqual("${res:XML.MainMenu.DebugMenu.RunWithoutDebug}", pythonWithoutDebuggerRunMenuItemCodon["label"]);
+ }
+
+ [Test]
+ public void PythonRunWithoutDebuggerMenuItemIsMenuItem()
+ {
+ Assert.AreEqual("MenuItem", pythonWithoutDebuggerRunMenuItemCodon.Name);
+ }
+
+ [Test]
+ public void PythonRunWithoutDebuggerMenuItemClass()
+ {
+ Assert.AreEqual("ICSharpCode.PythonBinding.RunPythonCommand", pythonWithoutDebuggerRunMenuItemCodon["class"]);
+ }
+
+ [Test]
+ public void PythonRunWithoutDebuggerMenuItemShortcut()
+ {
+ Assert.AreEqual("Control|Shift|W", pythonWithoutDebuggerRunMenuItemCodon["shortcut"]);
+ }
+
+ [Test]
+ public void PythonRunWithoutDebuggerMenuItemIcon()
+ {
+ Assert.AreEqual("Icons.16x16.Debug.StartWithoutDebugging", pythonWithoutDebuggerRunMenuItemCodon["icon"]);
+ }
+
+ [Test]
+ public void PythonDebugRunMenuHasSingleCondition()
+ {
+ Assert.AreEqual(1, pythonWithoutDebuggerRunMenuItemCodon.Conditions.Length);
+ }
+
+ [Test]
+ public void PythonDebugRunConditionIsSameAsPythonRunCondition()
+ {
+ Assert.AreEqual(pythonWithoutDebuggerRunMenuItemCodon.Conditions[0], pythonRunMenuItemCodon.Conditions[0]);
+ }
Codon GetCodon(string name, string extensionPath)
{
diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/DebugPythonCommandTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/DebugPythonCommandTestFixture.cs
new file mode 100644
index 0000000000..d93ee261ad
--- /dev/null
+++ b/src/AddIns/BackendBindings/Python/PythonBinding/Test/DebugPythonCommandTestFixture.cs
@@ -0,0 +1,63 @@
+//
+//
+//
+//
+// $Revision$
+//
+
+using System;
+using System.Diagnostics;
+using ICSharpCode.Core;
+using ICSharpCode.SharpDevelop.Debugging;
+using ICSharpCode.PythonBinding;
+using PythonBinding.Tests.Utils;
+using NUnit.Framework;
+
+namespace PythonBinding.Tests
+{
+ [TestFixture]
+ public class DebugPythonCommandTestFixture
+ {
+ MockDebugger debugger;
+ RunDebugPythonCommand command;
+
+ [TestFixtureSetUp]
+ public void SetUpFixture()
+ {
+ // Create dummy view content with the Python script.
+ MockViewContent viewContent = new MockViewContent();
+ viewContent.PrimaryFileName = @"C:\Projects\test.py";
+ MockWorkbenchWindow workbenchWindow = new MockWorkbenchWindow();
+ workbenchWindow.ActiveViewContent = viewContent;
+ MockWorkbench workbench = new MockWorkbench();
+ workbench.ActiveWorkbenchWindow = workbenchWindow;
+
+ // Create the Python binding addin options.
+ Properties p = new Properties();
+ AddInOptions options = new AddInOptions(p);
+ options.PythonFileName = @"C:\IronPython\ipy.exe";
+
+ debugger = new MockDebugger();
+ command = new RunDebugPythonCommand(workbench, options, debugger);
+ command.Run();
+ }
+
+ [Test]
+ public void DebuggerStartMethodCalled()
+ {
+ Assert.IsTrue(debugger.StartMethodCalled);
+ }
+
+ [Test]
+ public void ProcessInfoFileName()
+ {
+ Assert.AreEqual(@"C:\IronPython\ipy.exe", debugger.ProcessStartInfo.FileName);
+ }
+
+ [Test]
+ public void ProcessInfoArgs()
+ {
+ Assert.AreEqual("-D \"C:\\Projects\\test.py\"", debugger.ProcessStartInfo.Arguments);
+ }
+ }
+}
diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonBinding.Tests.csproj b/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonBinding.Tests.csproj
index 0f355d4b47..5338c2bf5b 100644
--- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonBinding.Tests.csproj
+++ b/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonBinding.Tests.csproj
@@ -152,6 +152,7 @@
+
@@ -277,7 +278,6 @@
-
@@ -297,6 +297,7 @@
+
@@ -349,6 +350,10 @@
{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}
ICSharpCode.SharpDevelop.Dom
+
+ {8035765F-D51F-4A0C-A746-2FD100E19419}
+ ICSharpCode.SharpDevelop.Widgets
+
{7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}
FormsDesigner
diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/RunPythonCommandTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/RunPythonCommandTestFixture.cs
index 4266ad5ff4..3bf0f7d0a4 100644
--- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/RunPythonCommandTestFixture.cs
+++ b/src/AddIns/BackendBindings/Python/PythonBinding/Test/RunPythonCommandTestFixture.cs
@@ -22,11 +22,8 @@ namespace PythonBinding.Tests
[TestFixture]
public class RunPythonCommandTestFixture
{
- MockProcessRunner processRunner;
- MessageViewCategory messageViewCategory;
- bool messageViewCategoryCleared;
- MockPadDescriptor padDescriptor;
- bool isRunning;
+ MockDebugger debugger;
+ RunPythonCommand command;
[TestFixtureSetUp]
public void SetUpFixture()
@@ -38,90 +35,39 @@ namespace PythonBinding.Tests
workbenchWindow.ActiveViewContent = viewContent;
MockWorkbench workbench = new MockWorkbench();
workbench.ActiveWorkbenchWindow = workbenchWindow;
-
- // Create a dummy output window pad descriptor.
- padDescriptor = new MockPadDescriptor();
-
+
// Create the Python binding addin options.
Properties p = new Properties();
AddInOptions options = new AddInOptions(p);
options.PythonFileName = @"C:\IronPython\ipy.exe";
-
- // Create the process runner.
- processRunner = new MockProcessRunner();
- processRunner.OutputText = "Test\r\nOutput";
-
- // Create the message view category.
- messageViewCategory = new MessageViewCategory("Python");
- messageViewCategory.TextSet += MessageViewCategoryCleared;
-
- // Run the command.
- RunPythonCommand command = new RunPythonCommand(workbench, options, processRunner, messageViewCategory, padDescriptor);
+
+ debugger = new MockDebugger();
+ command = new RunPythonCommand(workbench, options, debugger);
command.Run();
-
- // Check that the IsPythonRunning thinks the command is still
- // running.
- IsPythonRunningCondition condition = new IsPythonRunningCondition();
- isRunning = condition.IsValid(null, null);
-
- // The python console process exits.
- processRunner.RaiseExitEvent();
}
[Test]
- public void CommandLine()
+ public void RunPythonCommandIsAbstractCommand()
{
- // Check the correct filename was used to execute the command.
- Assert.AreEqual("C:\\IronPython\\ipy.exe \"C:\\Projects\\test.py\"", processRunner.CommandLine);
+ Assert.IsNotNull(command as AbstractCommand);
}
[Test]
- public void MessageViewCategoryClearTextCalled()
+ public void DebuggerStartWithoutDebuggingMethodCalled()
{
- Assert.IsTrue(messageViewCategoryCleared);
+ Assert.IsTrue(debugger.StartWithoutDebuggingMethodCalled);
}
- ///
- /// Message view category should have the command line
- /// used to start the python console and any output from it.
- ///
[Test]
- public void MessageViewCategoryText()
+ public void ProcessInfoFileName()
{
- string expectedText = "Running Python...\r\n" +
- "C:\\IronPython\\ipy.exe \"C:\\Projects\\test.py\"\r\n" +
- "Test\r\n" +
- "Output\r\n";
- Assert.AreEqual(expectedText, messageViewCategory.Text);
+ Assert.AreEqual(@"C:\IronPython\ipy.exe", debugger.ProcessStartInfo.FileName);
}
[Test]
- public void OutputWindowPadBroughtToFront()
- {
- Assert.IsTrue(padDescriptor.BringPadToFrontCalled);
- }
-
- ///
- /// Until the ipy.exe process exits the RunPythonCommand
- /// should return true from the IsRunning property.
- ///
- [Test]
- public void IsPythonRunningBeforeExit()
- {
- Assert.IsTrue(isRunning);
- }
-
- [Test]
- public void IsPythonRunningAfterExit()
- {
- IsPythonRunningCondition condition = new IsPythonRunningCondition();
- Assert.IsFalse(condition.IsValid(null, null));
- }
-
- void MessageViewCategoryCleared(object sender, TextEventArgs e)
+ public void ProcessInfoArgs()
{
- if (e.Text == "")
- messageViewCategoryCleared = true;
+ Assert.AreEqual("\"C:\\Projects\\test.py\"", debugger.ProcessStartInfo.Arguments);
}
}
}
diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/StopPythonCommandTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/StopPythonCommandTestFixture.cs
deleted file mode 100644
index 70009019e3..0000000000
--- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/StopPythonCommandTestFixture.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-//
-//
-//
-//
-// $Revision$
-//
-
-using System;
-using ICSharpCode.Core;
-using ICSharpCode.PythonBinding;
-using ICSharpCode.SharpDevelop;
-using ICSharpCode.SharpDevelop.Gui;
-using NUnit.Framework;
-using PythonBinding.Tests.Utils;
-
-namespace PythonBinding.Tests
-{
- ///
- /// Tests that the StopPythonCommand kills the python console process.
- ///
- [TestFixture]
- public class StopPythonCommandTestFixture
- {
- MockProcessRunner processRunner;
-
- [TestFixtureSetUp]
- public void SetUpFixture()
- {
- // Create dummy view content with the Python script.
- MockViewContent viewContent = new MockViewContent();
- viewContent.PrimaryFileName = @"C:\Projects\test.py";
- MockWorkbenchWindow workbenchWindow = new MockWorkbenchWindow();
- workbenchWindow.ActiveViewContent = viewContent;
- MockWorkbench workbench = new MockWorkbench();
- workbench.ActiveWorkbenchWindow = workbenchWindow;
-
- // Create a dummy output window pad descriptor.
- MockPadDescriptor padDescriptor = new MockPadDescriptor();
-
- // Create the Python binding addin options.
- Properties p = new Properties();
- AddInOptions options = new AddInOptions(p);
- options.PythonFileName = @"C:\IronPython\ipy.exe";
-
- // Create the process runner.
- processRunner = new MockProcessRunner();
-
- // Create the message view category.
- MessageViewCategory messageViewCategory = new MessageViewCategory("Python");
-
- // Run the command.
- RunPythonCommand command = new RunPythonCommand(workbench, options, processRunner, messageViewCategory, padDescriptor);
- command.Run();
-
- StopPythonCommand stopCommand = new StopPythonCommand();
- stopCommand.Run();
- }
-
- [Test]
- public void IsStopped()
- {
- // Check that the IsPythonRunning thinks the command has stopped
- IsPythonRunningCondition condition = new IsPythonRunningCondition();
- Assert.IsFalse(condition.IsValid(null, null));
- }
-
- [Test]
- public void ProcessRunnerStopped()
- {
- Assert.IsTrue(processRunner.KillCalled);
- }
- }
-}
diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/MockDebugger.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/MockDebugger.cs
new file mode 100644
index 0000000000..744816f912
--- /dev/null
+++ b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/MockDebugger.cs
@@ -0,0 +1,178 @@
+//
+//
+//
+//
+// $Revision$
+//
+
+using System;
+using System.Diagnostics;
+using ICSharpCode.SharpDevelop.Debugging;
+using ICSharpCode.SharpDevelop.Project;
+
+namespace PythonBinding.Tests.Utils
+{
+ public class MockDebugger : IDebugger
+ {
+ ProcessStartInfo processStartInfo;
+ bool startMethodCalled;
+ bool startWithoutDebuggingMethodCalled;
+ bool stopMethodCalled;
+
+ public MockDebugger()
+ {
+ }
+
+ ///
+ /// Gets the ProcessStartInfo passed to the Start or StartWithoutDebugging methods.
+ ///
+ public ProcessStartInfo ProcessStartInfo {
+ get { return processStartInfo; }
+ }
+
+ public bool StartMethodCalled {
+ get { return startMethodCalled; }
+ }
+
+ public bool StartWithoutDebuggingMethodCalled {
+ get { return startWithoutDebuggingMethodCalled; }
+ }
+
+ public bool StopMethodCalled {
+ get { return stopMethodCalled; }
+ }
+
+ public event EventHandler DebugStarting;
+ public event EventHandler DebugStarted;
+ public event EventHandler IsProcessRunningChanged;
+ public event EventHandler DebugStopped;
+
+ public bool IsDebugging {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ public bool IsProcessRunning {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ public bool CanDebug(IProject project)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void Start(ProcessStartInfo processStartInfo)
+ {
+ this.processStartInfo = processStartInfo;
+ startMethodCalled = true;
+ }
+
+ public void StartWithoutDebugging(ProcessStartInfo processStartInfo)
+ {
+ this.processStartInfo = processStartInfo;
+ startWithoutDebuggingMethodCalled = true;
+ }
+
+ public void Stop()
+ {
+ stopMethodCalled = true;
+ }
+
+ public void Break()
+ {
+ throw new NotImplementedException();
+ }
+
+ public void Continue()
+ {
+ throw new NotImplementedException();
+ }
+
+ public void StepInto()
+ {
+ throw new NotImplementedException();
+ }
+
+ public void StepOver()
+ {
+ throw new NotImplementedException();
+ }
+
+ public void StepOut()
+ {
+ throw new NotImplementedException();
+ }
+
+ public void ShowAttachDialog()
+ {
+ throw new NotImplementedException();
+ }
+
+ public void Attach(System.Diagnostics.Process process)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void Detach()
+ {
+ throw new NotImplementedException();
+ }
+
+ public string GetValueAsString(string variable)
+ {
+ throw new NotImplementedException();
+ }
+
+ public DebuggerGridControl GetTooltipControl(string variable)
+ {
+ throw new NotImplementedException();
+ }
+
+ public bool CanSetInstructionPointer(string filename, int line, int column)
+ {
+ throw new NotImplementedException();
+ }
+
+ public bool SetInstructionPointer(string filename, int line, int column)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void Dispose()
+ {
+ throw new NotImplementedException();
+ }
+
+ protected virtual void OnDebugStarting(EventArgs e)
+ {
+ if (DebugStarting != null) {
+ DebugStarting(this, e);
+ }
+ }
+
+
+ protected virtual void OnDebugStarted(EventArgs e)
+ {
+ if (DebugStarted != null) {
+ DebugStarted(this, e);
+ }
+ }
+
+ protected virtual void OnIsProcessRunningChanged(EventArgs e)
+ {
+ if (IsProcessRunningChanged != null) {
+ IsProcessRunningChanged(this, e);
+ }
+ }
+
+ protected virtual void OnDebugStopped(EventArgs e)
+ {
+ if (DebugStopped != null) {
+ DebugStopped(this, e);
+ }
+ }
+ }
+}