public void SetUpFixture()
		{
			projectBinding = new PythonProjectBinding();
			ProjectCreateInformation createInfo = new ProjectCreateInformation();
			createInfo.ProjectName = "Python";
			createInfo.OutputProjectFileName = @"C:\Projects\Python.pyproj";
			createInfo.Solution = new Solution(new MockProjectChangeWatcher());
			project = projectBinding.CreateProject(createInfo) as PythonProject;
		}
		public void IsTestProjectReturnsTrueForPythonProject()
		{
			ProjectCreateInformation createInfo = new ProjectCreateInformation();
			createInfo.Solution = new Solution();
			createInfo.OutputProjectFileName = @"C:\projects\test.pyproj";
			PythonProject project = new PythonProject(createInfo);
			
			Assert.IsTrue(testFramework.IsTestProject(project));
		}
		public void SetUpFixture()
		{
			PythonMSBuildEngineHelper.InitMSBuildEngine();
			
			info = new ProjectCreateInformation();
			info.Solution = new Solution();
			info.ProjectName = "Test";
			info.OutputProjectFileName = @"C:\Projects\Test\Test.pyproj";
			info.RootNamespace = "Test";

			project = new PythonProject(info);
		}
		public void SetUpFixture()
		{
			PythonMSBuildEngineHelper.InitMSBuildEngine();

			List<ProjectBindingDescriptor> bindings = new List<ProjectBindingDescriptor>();
			using (TextReader reader = PythonBindingAddInFile.ReadAddInFile()) {
				AddIn addin = AddIn.Load(reader, String.Empty);
				bindings.Add(new ProjectBindingDescriptor(AddInHelper.GetCodon(addin, "/SharpDevelop/Workbench/ProjectBindings", "Python")));
			}
			ProjectBindingService.SetBindings(bindings);
			
			// Set up IProjectContent so the ConvertProjectToPythonProjectCommand can
			// locate the startup object and determine it's filename.
			
			mockProjectContent = new ICSharpCode.Scripting.Tests.Utils.MockProjectContent();
			MockClass mainClass = new MockClass(mockProjectContent, startupObject);
			mainClass.CompilationUnit.FileName = @"d:\projects\test\src\Main2.cs";
			mockProjectContent.SetClassToReturnFromGetClass(startupObject, mainClass);
			
			convertProjectCommand = new DerivedConvertProjectToPythonProjectCommand();
			convertProjectCommand.ProjectContent = mockProjectContent;
			convertProjectCommand.FileServiceDefaultEncoding = Encoding.Unicode;
			
			Solution solution = new Solution(new MockProjectChangeWatcher());
			sourceProject = new MSBuildBasedProject(
				new ProjectCreateInformation() {
					Solution = solution,
					OutputProjectFileName = @"d:\projects\test\source.csproj",
					ProjectName = "source"
				});
			sourceProject.Parent = solution;
			sourceProject.SetProperty(null, null, "StartupObject", startupObject, PropertyStorageLocations.Base, true);
			mainFile = new FileProjectItem(sourceProject, ItemType.Compile, @"src\Main.cs");
			targetProject = (PythonProject)convertProjectCommand.CallCreateProject(@"d:\projects\test\converted", sourceProject);
			convertProjectCommand.CallCopyProperties(sourceProject, targetProject);
			targetMainFile = new FileProjectItem(targetProject, mainFile.ItemType, mainFile.Include);
			mainFile.CopyMetadataTo(targetMainFile);
			
			main2File = new FileProjectItem(sourceProject, ItemType.Compile, @"src\Main2.cs");
			targetMain2File = new FileProjectItem(targetProject, main2File.ItemType, main2File.Include);
			main2File.CopyMetadataTo(targetMain2File);
			
			convertProjectCommand.AddParseableFileContent(mainFile.FileName, mainSource);
			convertProjectCommand.AddParseableFileContent(main2File.FileName, main2Source);
			
			convertProjectCommand.CallConvertFile(mainFile, targetMainFile);
			convertProjectCommand.CallConvertFile(main2File, targetMain2File);
		}
		public void SetUp()
		{
			PythonMSBuildEngineHelper.InitMSBuildEngine();
			
			ProjectCreateInformation info = new ProjectCreateInformation();
			info.Solution = new Solution(new MockProjectChangeWatcher());
			info.ProjectName = "Test";
			info.OutputProjectFileName = @"C:\Projects\Test\Test.pyproj";
			info.RootNamespace = "Test";
			
			project = new PythonProject(info);
			
			appSettingsPanel = new DerivedApplicationSettingsPanel();
			appSettingsPanel.Owner = project;
			appSettingsPanel.LoadPanelContents();
		}
		public void SetUp()
		{
			PythonMSBuildEngineHelper.InitMSBuildEngine();
			
			ProjectCreateInformation info = new ProjectCreateInformation();
			info.Solution = new Solution();
			info.ProjectName = "Test";
			info.OutputProjectFileName = @"C:\Projects\Test\Test.pyproj";
			info.RootNamespace = "Test";
			
			project = new PythonProject(info);
			
			compilingOptionsPanel = new DerivedCompilingOptionsPanel();
			compilingOptionsPanel.Owner = project;
			compilingOptionsPanel.LoadPanelContents();
		}
		public void SetUpFixture()
		{
			PythonMSBuildEngineHelper.InitMSBuildEngine();

			List<ProjectBindingDescriptor> bindings = new List<ProjectBindingDescriptor>();
			using (TextReader reader = PythonBindingAddInFile.ReadAddInFile()) {
				AddIn addin = AddIn.Load(reader, String.Empty);
				bindings.Add(new ProjectBindingDescriptor(AddInHelper.GetCodon(addin, "/SharpDevelop/Workbench/ProjectBindings", "Python")));
			}
			ProjectBindingService.SetBindings(bindings);
			
			convertProjectCommand = new DerivedConvertProjectToPythonProjectCommand();
			convertProjectCommand.FileServiceDefaultEncoding = Encoding.Unicode;
			
			sourceProject = new MockProject();
			sourceProject.Directory = @"d:\projects\test";
			source = new FileProjectItem(sourceProject, ItemType.Compile, @"src\Program.cs");
			targetProject = (PythonProject)convertProjectCommand.CallCreateProject(@"d:\projects\test\converted", sourceProject);
			target = new FileProjectItem(targetProject, source.ItemType, source.Include);
			source.CopyMetadataTo(target);
			
			textFileSource = new FileProjectItem(sourceProject, ItemType.None, @"src\readme.txt");
			textFileTarget = new FileProjectItem(targetProject, textFileSource.ItemType, textFileSource.Include);
			textFileSource.CopyMetadataTo(textFileTarget);
			
			foreach (ProjectItem item in targetProject.Items) {
				ReferenceProjectItem reference = item as ReferenceProjectItem;
				if ((reference != null) && (reference.Name == "IronPython")) {
					ironPythonReference = reference;
					break;
				}
			}
			
			convertProjectCommand.AddParseableFileContent(source.FileName, sourceCode);
			
			convertProjectCommand.CallConvertFile(source, target);
			convertProjectCommand.CallConvertFile(textFileSource, textFileTarget);
		}
		/// <summary>
		/// Adds a MainFile if the source project has a StartupObject.
		/// </summary>
		void AddMainFile(IProject sourceProject, PythonProject targetProject)
		{
			string startupObject = GetStartupObject(sourceProject);
			if (startupObject != null) {
				IClass c = FindClass(sourceProject, startupObject);
				if (c != null) {
					string fileName = FileUtility.GetRelativePath(sourceProject.Directory, c.CompilationUnit.FileName);
					targetProject.AddMainFile(ChangeFileExtensionToPythonFileExtension(fileName));
				}
			}			
		}
Example #9
0
		public void CanParsePythonProject()
		{
			ProjectCreateInformation createInfo = new ProjectCreateInformation();
			createInfo.Solution = new Solution(new MockProjectChangeWatcher());
			createInfo.OutputProjectFileName = @"C:\projects\test.pyproj";
			PythonProject project = new PythonProject(createInfo);
			Assert.IsTrue(parser.CanParse(project));
		}
Example #10
0
		public PythonProjectBehavior(PythonProject project, ProjectBehavior next = null)
			: base(project, next)
		{
			
		}
Example #11
0
 public PythonProjectBehavior(PythonProject project, ProjectBehavior next = null)
     : base(project, next)
 {
 }