/// <summary> /// Debugs a project with and without a process-wide PYTHONPATH value. /// If <see cref="DebugPythonProjectSubFolderStartupFileSysPath"/> fails /// this test may also fail. /// </summary> public void DebugPythonProjectWithAndWithoutClearingPythonPath(VisualStudioApp app, DotNotWaitOnNormalExit optionSetter) { var sysPathSln = app.CopyProjectForTest(@"TestData\SysPath.sln"); var helloWorldSln = app.CopyProjectForTest(@"TestData\HelloWorld.sln"); var testDataPath = Path.Combine(PathUtils.GetParent(helloWorldSln), "HelloWorld").Replace("\\", "\\\\"); var pyService = app.ServiceProvider.GetUIThread().Invoke(() => app.ServiceProvider.GetPythonToolsService()); using (new EnvironmentVariableSetter("PYTHONPATH", testDataPath)) { app.OpenProject(sysPathSln); using (new PythonServiceGeneralOptionsSetter(pyService, clearGlobalPythonPath: false)) { ClearOutputWindowDebugPaneText(app); app.Dte.ExecuteCommand("Debug.Start"); WaitForMode(app, dbgDebugMode.dbgDesignMode); WaitForDebugOutput(app, text => text.Contains(testDataPath)); } ClearOutputWindowDebugPaneText(app); app.Dte.ExecuteCommand("Debug.Start"); WaitForMode(app, dbgDebugMode.dbgDesignMode); var outputWindowText = WaitForDebugOutput(app, text => text.Contains("DONE")); Assert.IsFalse(outputWindowText.Contains(testDataPath), outputWindowText); } }
public void AttachThreadsBreakOneAndSetExitFlag(VisualStudioApp app) { string debugSolution = app.CopyProjectForTest(@"TestData\DebugAttach\DebugAttach.sln"); string startFile = "fg.py"; int breakLine = 8; var dbg2 = (Debugger2)app.Dte.Debugger; SD.Process processToAttach = OpenSolutionAndLaunchFile(app, debugSolution, startFile, "", ""); try { Process2 proc = AttachAndWaitForMode(app, processToAttach, AD7Engine.DebugEngineName, dbgDebugMode.dbgRunMode); dbg2.Breakpoints.Add(File: startFile, Line: breakLine); DebugProjectUITests.WaitForMode(app, dbgDebugMode.dbgBreakMode); dbg2.BreakpointLastHit.Delete(); var x = proc.Threads.Cast <Thread2>() .SelectMany <Thread2, StackFrame>(t => t.StackFrames.Cast <StackFrame>()) .SelectMany <StackFrame, Expression>(f => f.Locals.Cast <Expression>()) .Where(e => e.Name == "exit_flag") .First(); Assert.IsNotNull(x, "Couldn't find a frame with 'exit_flag' defined!"); x.Value = "True"; dbg2.Go(WaitForBreakOrEnd: false); DebugProjectUITests.WaitForMode(app, dbgDebugMode.dbgDesignMode); } finally { if (!processToAttach.HasExited) { processToAttach.Kill(); } } }
public void DjangoProjectWithSubdirectory(VisualStudioApp app, DjangoInterpreterSetter interpreterSetter) { var sln = app.CopyProjectForTest(@"TestData\DjangoProjectWithSubDirectory.sln"); var slnDir = PathUtils.GetParent(sln); var project = app.OpenProject(sln); var pyProj = project.GetPythonProject(); var dsm = pyProj.Site.GetUIThread().Invoke(() => pyProj.GetProperty("DjangoSettingsModule")); Assert.AreEqual("config.settings", dsm); var workDir = pyProj.Site.GetUIThread().Invoke(() => pyProj.GetWorkingDirectory()).TrimEnd('\\'); Assert.AreEqual(Path.Combine(slnDir, "DjangoProjectWithSubDirectory", "project"), workDir, true); var cmd = pyProj.FindCommand("DjangoCollectStaticCommand"); pyProj.Site.GetUIThread().Invoke(() => { Assert.IsTrue(cmd.CanExecute(pyProj), "Cannot execute DjangoCollectStaticCommand"); cmd.Execute(pyProj); }); // The static dir is 'test_static', check that the admin files // are copied into there. Assert.IsTrue(Directory.Exists(Path.Combine(workDir, "test_static", "admin")), "admin static directory was not created"); Assert.IsTrue(File.Exists(Path.Combine(workDir, "test_static", "admin", "css", "base.css")), "admin static files were not copied"); }
private static void RemoveSmartTagTest(VisualStudioApp app, string filename, int line, int column, bool allScopes, string expectedText) { var project = app.OpenProject(app.CopyProjectForTest(@"TestData\RemoveImport.sln")); var item = project.ProjectItems.Item(filename); var window = item.Open(); window.Activate(); var doc = app.GetDocument(item.Document.FullName); VsProjectAnalyzer analyzer = null; doc.InvokeTask(async() => { var point = doc.TextView.TextBuffer.CurrentSnapshot.GetLineFromLineNumber(line - 1).Start.Add(column - 1); doc.TextView.Caret.MoveTo(point); analyzer = await doc.WaitForAnalyzerAtCaretAsync(); }); Assert.IsNotNull(analyzer, "Failed to get analyzer"); analyzer.WaitForCompleteAnalysis(_ => true); if (allScopes) { app.ExecuteCommand("EditorContextMenus.CodeWindow.RemoveImports.AllScopes"); } else { app.ExecuteCommand("EditorContextMenus.CodeWindow.RemoveImports.CurrentScope"); } doc.WaitForText(expectedText); }
/// <summary> /// Make sure deleting a project clears the error list when there are errors in multiple files /// /// Take 2 of https://pytools.codeplex.com/workitem/1523 /// </summary> public void ErrorListAndTaskListAreClearedWhenProjectWithMultipleFilesIsUnloaded(VisualStudioApp app) { var project = app.OpenProject(app.CopyProjectForTest(@"TestData\ErrorProjectMultipleFiles.sln")); var projectNode = project.GetPythonProject(); app.OpenDocument(Path.Combine(projectNode.ProjectHome, "Program.py")); app.OpenDocument(Path.Combine(projectNode.ProjectHome, "Program2.py")); app.OpenErrorList(); //app.OpenTaskList(); app.WaitForTaskListItems(typeof(SVsErrorList), 14); //app.WaitForTaskListItems(typeof(SVsTaskList), 4); var solutionService = app.GetService <IVsSolution>(typeof(SVsSolution)); Assert.IsNotNull(solutionService); IVsHierarchy selectedHierarchy; ErrorHandler.ThrowOnFailure(solutionService.GetProjectOfUniqueName(project.UniqueName, out selectedHierarchy)); Assert.IsNotNull(selectedHierarchy); Console.WriteLine("Unloading project"); ErrorHandler.ThrowOnFailure(solutionService.CloseSolutionElement((uint)__VSSLNCLOSEOPTIONS.SLNCLOSEOPT_UnloadProject, selectedHierarchy, 0)); app.WaitForTaskListItems(typeof(SVsErrorList), 0); //app.WaitForTaskListItems(typeof(SVsTaskList), 0); }
public void AddDeleteItem2(VisualStudioApp app) { var sln = app.CopyProjectForTest(@"TestData\ProjectHomeSingleProject.sln"); var slnDir = PathUtils.GetParent(sln); var project = app.OpenProject(sln); var folder = project.ProjectItems.Item("Subfolder"); Assert.AreEqual("ProjectSingle.pyproj", Path.GetFileName(project.FileName)); folder.ProjectItems.AddFromTemplate(((Solution2)app.Dte.Solution).GetProjectItemTemplate("PyClass.zip", "pyproj"), "TemplateItem.py"); var newItem = folder.ProjectItems.Item("TemplateItem.py"); Assert.IsNotNull(newItem); Assert.AreEqual(false, project.Saved); project.Save(); Assert.AreEqual(true, project.Saved); Assert.IsTrue(File.Exists(Path.Combine(slnDir, "ProjectHomeProjects", "Subfolder", "TemplateItem.py"))); newItem.Delete(); Assert.AreEqual(false, project.Saved); project.Save(); Assert.AreEqual(true, project.Saved); Assert.IsFalse(File.Exists(Path.Combine(slnDir, "ProjectHomeProjects", "Subfolder", "TemplateItem.py"))); }
public void SaveProjectAndCheckProjectHome(VisualStudioApp app) { var sln = app.CopyProjectForTest(@"TestData\HelloWorld.sln"); var slnDir = PathUtils.GetParent(sln); EnvDTE.Project project; try { project = app.OpenProject(sln); project.SaveAs(Path.Combine(slnDir, "ProjectHomeProjects", "TempFile.pyproj")); Assert.AreEqual( PathUtils.TrimEndSeparator(Path.Combine(slnDir, "HelloWorld")), PathUtils.TrimEndSeparator(((OAProject)project).ProjectNode.ProjectHome) ); app.Dte.Solution.SaveAs("HelloWorldRelocated.sln"); } finally { app.Dte.Solution.Close(); GC.Collect(); GC.WaitForPendingFinalizers(); } project = app.OpenProject(Path.Combine(slnDir, "HelloWorldRelocated.sln")); Assert.AreEqual("TempFile.pyproj", project.FileName); Assert.AreEqual( PathUtils.TrimEndSeparator(Path.Combine(slnDir, "HelloWorld")), PathUtils.TrimEndSeparator(((OAProject)project).ProjectNode.ProjectHome) ); }
public void CutPasteRelocatedTest(VisualStudioApp app) { var sln = app.CopyProjectForTest(@"TestData\CutPasteRelocatedTest.sln"); var slnDir = PathUtils.GetParent(sln); FileUtils.CopyDirectory(TestData.GetPath("TestData", "CutPasteRelocatedTest"), Path.Combine(slnDir, "CutPasteRelocatedTest")); app.OpenProject(sln); app.OpenSolutionExplorer(); var window = app.SolutionExplorerTreeView; var folder = window.FindItem("Solution 'CutPasteRelocatedTest' (1 project)", "CutPasteTest", "TestFolder", "SubItem.py"); AutomationWrapper.Select(folder); app.ExecuteCommand("Edit.Cut"); var projectItem = window.FindItem("Solution 'CutPasteRelocatedTest' (1 project)", "CutPasteTest"); AutomationWrapper.Select(projectItem); app.ExecuteCommand("Edit.Paste"); Assert.IsNotNull(window.WaitForItem("Solution 'CutPasteRelocatedTest' (1 project)", "CutPasteTest", "SubItem.py")); app.Dte.Solution.Close(true); // Ensure file was moved and the path was updated correctly. var project = app.OpenProject(sln); foreach (var item in project.ProjectItems.OfType <OAFileItem>()) { Assert.IsTrue(File.Exists((string)item.Properties.Item("FullPath").Value), (string)item.Properties.Item("FullPath").Value); } }
public void PendingBreakPointLocation(VisualStudioApp app, DotNotWaitOnNormalExit optionSetter) { var sln = app.CopyProjectForTest(@"TestData\DebuggerProject.sln"); var project = app.OpenProject(sln, "BreakpointInfo.py"); var bpInfo = project.ProjectItems.Item("BreakpointInfo.py"); project.GetPythonProject().GetAnalyzer().WaitForCompleteAnalysis(x => true); var bp = app.Dte.Debugger.Breakpoints.Add(File: "BreakpointInfo.py", Line: 2); Assert.AreEqual("Python", bp.Item(1).Language); // FunctionName doesn't get queried for when adding the BP via EnvDTE, so we can't assert here :( //Assert.AreEqual("BreakpointInfo.C", bp.Item(1).FunctionName); bp = app.Dte.Debugger.Breakpoints.Add(File: "BreakpointInfo.py", Line: 3); Assert.AreEqual("Python", bp.Item(1).Language); //Assert.AreEqual("BreakpointInfo.C.f", bp.Item(1).FunctionName); bp = app.Dte.Debugger.Breakpoints.Add(File: "BreakpointInfo.py", Line: 6); Assert.AreEqual("Python", bp.Item(1).Language); //Assert.AreEqual("BreakpointInfo", bp.Item(1).FunctionName); bp = app.Dte.Debugger.Breakpoints.Add(File: "BreakpointInfo.py", Line: 7); Assert.AreEqual("Python", bp.Item(1).Language); //Assert.AreEqual("BreakpointInfo.f", bp.Item(1).FunctionName); // https://github.com/Microsoft/PTVS/pull/630 // Make sure }
private static void RemoveLightBulbTest(VisualStudioApp app, string filename, int line, int column, bool allScopes, string expectedText) { var project = app.OpenProject(app.CopyProjectForTest(@"TestData\RemoveImport.sln")); var item = project.ProjectItems.Item(filename); var window = item.Open(); window.Activate(); var doc = app.GetDocument(item.Document.FullName); doc.InvokeTask(async() => { var point = doc.TextView.TextBuffer.CurrentSnapshot.GetLineFromLineNumber(line - 1).Start.Add(column - 1); doc.TextView.Caret.MoveTo(point); // Note that this waits for language server to be up and running // but that doesn't mean the quick actions are ready for that document // so the test will need to wait/try again until the correct results // are in or until a predetermined timeout. await doc.WaitForLanguageServerInitializedAtCaretAsync(); }); if (allScopes) { app.ExecuteCommand("EditorContextMenus.CodeWindow.RemoveImports.AllScopes"); } else { app.ExecuteCommand("EditorContextMenus.CodeWindow.RemoveImports.CurrentScope"); } doc.WaitForText(expectedText); }
internal void OpenProject(VisualStudioApp app, string slnName, PythonVersion python, out PythonProjectNode projectNode, out EnvDTE.Project dteProject) { dteProject = app.OpenProject(app.CopyProjectForTest("TestData\\Targets\\" + slnName)); var pn = projectNode = dteProject.GetPythonProject(); var fact = projectNode.InterpreterFactories.Where(x => x.Configuration.Id == python.Id).FirstOrDefault(); Assert.IsNotNull(fact, "Project does not contain expected interpreter"); app.ServiceProvider.GetUIThread().Invoke(() => pn.ActiveInterpreter = fact); dteProject.Save(); }
public void AddDifferentFileType(VisualStudioApp app) { var fullPath = app.CopyProjectForTest(@"TestData\HelloWorld.sln"); var project = app.OpenProject(fullPath); // "Python Environments", "References", "Search Paths", "Program.py" Assert.AreEqual(4, project.ProjectItems.Count); var item = project.ProjectItems.AddFromFileCopy(TestData.GetPath(@"TestData\Xaml\EmptyXName.xaml")); Assert.AreEqual("EmptyXName.xaml", item.Properties.Item("FileName").Value); }
/// <summary> /// Make sure deleting a file w/ errors clears the error list /// </summary> public void ErrorListAndTaskListAreClearedWhenFileIsDeleted(VisualStudioApp app) { var project = app.OpenProject(app.CopyProjectForTest(@"TestData\ErrorProjectDeleteFile.sln")); app.WaitForTaskListItems(typeof(SVsErrorList), 7); app.WaitForTaskListItems(typeof(SVsTaskList), 2); Console.WriteLine("Deleting file"); project.ProjectItems.Item("Program.py").Delete(); app.WaitForTaskListItems(typeof(SVsErrorList), 0); app.WaitForTaskListItems(typeof(SVsTaskList), 0); }
internal static Project OpenProjectAndBreak(VisualStudioApp app, string projName, string filename, int lineNo, bool setStartupItem = true) { var projectPath = app.CopyProjectForTest(projName); var project = app.OpenProject(projectPath, filename, setStartupItem: setStartupItem); app.Dte.Debugger.Breakpoints.Add(File: filename, Line: lineNo); app.Dte.ExecuteCommand("Debug.Start"); WaitForMode(app, dbgDebugMode.dbgBreakMode); Assert.IsNotNull(app.Dte.Debugger.BreakpointLastHit); Assert.AreEqual(lineNo, app.Dte.Debugger.BreakpointLastHit.FileLine); return(project); }
/// <summary> /// Make sure *.pyi files ignore the active Python version /// </summary> public void ErrorListEmptyForValidTypingFile(VisualStudioApp app) { var project = app.OpenProject(app.CopyProjectForTest(@"TestData\Typings.sln")); var projectNode = project.GetPythonProject(); app.OpenDocument(Path.Combine(projectNode.ProjectHome, "mymod.pyi")); app.OpenDocument(Path.Combine(projectNode.ProjectHome, "usermod.py")); app.OpenErrorList(); var actual = app.WaitForTaskListItems(typeof(SVsErrorList), 1); Assert.AreEqual(1, actual.Count); ErrorHandler.ThrowOnFailure(actual[0].Document(out var doc)); Assert.AreEqual("usermod.py", Path.GetFileName(doc)); }
/// <summary> /// Tests using a custom interpreter path that doesn't exist /// </summary> public void DebugPythonCustomInterpreterMissing(VisualStudioApp app, DotNotWaitOnNormalExit optionSetter) { var sln = app.CopyProjectForTest(@"TestData\RelativeInterpreterPath.sln"); var project = app.OpenProject(sln, "Program.py"); var interpreterPath = Path.Combine(PathUtils.GetParent(sln), "Interpreter.exe"); app.Dte.ExecuteCommand("Debug.Start"); string expectedMissingInterpreterText = string.Format( "The project cannot be launched because no Python interpreter is available at \"{0}\". Please check the " + "Python Environments window and ensure the version of Python is installed and has all settings specified.", interpreterPath); var dialog = app.WaitForDialog(); app.CheckMessageBox(expectedMissingInterpreterText); }
/// <summary> /// Loads a project with the startup file in a subdirectory, ensuring that syspath is correct when debugging. /// </summary> public void DebugPythonProjectSubFolderStartupFileSysPath(VisualStudioApp app, DotNotWaitOnNormalExit optionSetter) { var sln = app.CopyProjectForTest(@"TestData\SysPath.sln"); var project = app.OpenProject(sln); ClearOutputWindowDebugPaneText(app); app.Dte.ExecuteCommand("Debug.Start"); WaitForMode(app, dbgDebugMode.dbgDesignMode); // sys.path should point to the startup file directory, not the project directory. // this matches the behavior of start without debugging. // Note: backslashes are escaped in the output string testDataPath = Path.Combine(Path.GetDirectoryName(project.FullName), "Sub").Replace("\\", "\\\\"); WaitForDebugOutput(app, text => text.Contains(testDataPath)); }
/// <summary> /// Make sure task comments in a file show up in the task list window. /// </summary> public void CommentTaskList(VisualStudioApp app) { var project = app.OpenProject(app.CopyProjectForTest(@"TestData\ErrorProject.sln")); var projectNode = project.GetPythonProject(); var expectedDocument = Path.Combine(projectNode.ProjectHome, "Program.py"); var expectedCategory = VSTASKCATEGORY.CAT_COMMENTS; var expectedItems = new[] { new TaskItemInfo(expectedDocument, 4, 5, VSTASKPRIORITY.TP_NORMAL, expectedCategory, null, "TODO 123"), new TaskItemInfo(expectedDocument, 5, 0, VSTASKPRIORITY.TP_HIGH, expectedCategory, null, "456 UnresolvedMergeConflict"), }; app.OpenDocument(expectedDocument); app.OpenTaskList(); TaskListTest(app, typeof(SVsTaskList), expectedItems, navigateTo: new[] { 0, 1 }); }
/// <summary> /// Make sure deleting a project clears the error list /// </summary> public void ErrorListAndTaskListAreClearedWhenProjectIsDeleted(VisualStudioApp app) { var project = app.OpenProject(app.CopyProjectForTest(@"TestData\ErrorProjectDelete.sln")); var projectNode = project.GetPythonProject(); app.OpenDocument(Path.Combine(projectNode.ProjectHome, "Program.py")); app.OpenErrorList(); //app.OpenTaskList(); app.WaitForTaskListItems(typeof(SVsErrorList), 7); //app.WaitForTaskListItems(typeof(SVsTaskList), 2); Console.WriteLine("Deleting project"); app.Dte.Solution.Remove(project); app.WaitForTaskListItems(typeof(SVsErrorList), 0); //app.WaitForTaskListItems(typeof(SVsTaskList), 0); }
/// <summary> /// Tests using a custom interpreter path that is relative /// </summary> public void DebugPythonCustomInterpreter(VisualStudioApp app, DotNotWaitOnNormalExit optionSetter) { var sln = app.CopyProjectForTest(@"TestData\RelativeInterpreterPath.sln"); var project = app.OpenProject(sln, "Program.py"); var interpreterPath = Path.Combine(PathUtils.GetParent(sln), "Interpreter.exe"); File.Copy(PythonPaths.Python27.InterpreterPath, interpreterPath, true); app.Dte.Debugger.Breakpoints.Add(File: "Program.py", Line: 1); app.Dte.ExecuteCommand("Debug.Start"); WaitForMode(app, dbgDebugMode.dbgBreakMode); Assert.IsNotNull(app.Dte.Debugger.BreakpointLastHit); Assert.AreEqual(1, app.Dte.Debugger.BreakpointLastHit.FileLine); app.Dte.Debugger.Go(WaitForBreakOrEnd: true); Assert.AreEqual(dbgDebugMode.dbgDesignMode, app.Dte.Debugger.CurrentMode); }
public void AttachLotsOfThreads(VisualStudioApp app) { string debugSolution = app.CopyProjectForTest(@"TestData\DebugAttach\DebugAttach.sln"); string startFile = "LotsOfThreads.py"; var dbg2 = (Debugger2)app.Dte.Debugger; SD.Process processToAttach = OpenSolutionAndLaunchFile(app, debugSolution, startFile, "", ""); System.Threading.Thread.Sleep(2000); try { Process2 proc = AttachAndWaitForMode(app, processToAttach, AD7Engine.DebugEngineName, dbgDebugMode.dbgRunMode); } finally { if (!processToAttach.HasExited) { processToAttach.Kill(); } } }
public void AttachBasic(VisualStudioApp app) { string debugSolution = app.CopyProjectForTest(@"TestData\DebugAttach\DebugAttach.sln"); string startFile = "Simple.py"; var dbg2 = (Debugger2)app.Dte.Debugger; SD.Process processToAttach = OpenSolutionAndLaunchFile(app, debugSolution, startFile, "", ""); try { AttachAndWaitForMode(app, processToAttach, AD7Engine.DebugEngineName, dbgDebugMode.dbgRunMode); } finally { dbg2.DetachAll(); DebugProjectUITests.WaitForMode(app, dbgDebugMode.dbgDesignMode); if (!processToAttach.HasExited) { processToAttach.Kill(); } } }
/// <summary> /// Make sure errors in a file show up in the error list window. /// </summary> public void ErrorList(VisualStudioApp app) { var project = app.OpenProject(app.CopyProjectForTest(@"TestData\ErrorProject.sln")); var projectNode = project.GetPythonProject(); var expectedDocument = Path.Combine(projectNode.ProjectHome, "Program.py"); var expectedCategory = VSTASKCATEGORY.CAT_CODESENSE; var expectedItems = new[] { new TaskItemInfo(expectedDocument, 2, 8, VSTASKPRIORITY.TP_HIGH, expectedCategory, null, "unexpected indent"), new TaskItemInfo(expectedDocument, 2, 13, VSTASKPRIORITY.TP_HIGH, expectedCategory, null, "unexpected token '('"), new TaskItemInfo(expectedDocument, 2, 30, VSTASKPRIORITY.TP_HIGH, expectedCategory, null, "unexpected token ')'"), new TaskItemInfo(expectedDocument, 2, 31, VSTASKPRIORITY.TP_HIGH, expectedCategory, null, "unexpected token '<newline>'"), new TaskItemInfo(expectedDocument, 3, 0, VSTASKPRIORITY.TP_HIGH, expectedCategory, null, "unexpected token '<NL>'"), new TaskItemInfo(expectedDocument, 3, 0, VSTASKPRIORITY.TP_HIGH, expectedCategory, null, "unexpected token '<dedent>'"), new TaskItemInfo(expectedDocument, 4, 0, VSTASKPRIORITY.TP_HIGH, expectedCategory, null, "unexpected token 'pass'"), }; app.OpenDocument(expectedDocument); app.OpenErrorList(); TaskListTest(app, typeof(SVsErrorList), expectedItems, navigateTo: new[] { 0, 1, 2, 3, 4, 5, 6 }); }
public void TestPublishVirtualEnvironment(VisualStudioApp app) { var project = app.OpenProject(app.CopyProjectForTest(@"TestData\VirtualEnv.sln")); var dir = TestData.GetTempPath(); project.Properties.Item("PublishUrl").Value = dir; app.OnDispose(() => project.Properties.Item("PublishUrl").Value = ""); app.OpenSolutionExplorer().SelectProject(project); var files = PublishAndWaitForFiles(app, "Build.PublishSelection", dir); Assert.IsNotNull(files, "Timed out waiting for files to publish"); AssertUtil.ContainsAtLeast( files.Select(f => CommonUtils.GetRelativeFilePath(dir, f).ToLowerInvariant()), "env\\include\\pyconfig.h", "env\\lib\\site.py", "env\\scripts\\python.exe", "program.py" ); Directory.Delete(dir, true); }
public void DragDropRelocatedTest(VisualStudioApp app) { var sln = app.CopyProjectForTest(@"TestData\DragDropRelocatedTest.sln"); var slnDir = PathUtils.GetParent(sln); FileUtils.CopyDirectory(TestData.GetPath("TestData", "DragDropRelocatedTest"), Path.Combine(slnDir, "DragDropRelocatedTest")); app.OpenProject(sln); app.OpenSolutionExplorer(); var window = app.SolutionExplorerTreeView; var folder = window.FindItem("Solution 'DragDropRelocatedTest' (1 project)", "DragDropTest", "TestFolder", "SubItem.py"); var point = folder.GetClickablePoint(); Mouse.MoveTo(point); Mouse.Down(MouseButton.Left); var projectItem = window.FindItem("Solution 'DragDropRelocatedTest' (1 project)", "DragDropTest"); point = projectItem.GetClickablePoint(); Mouse.MoveTo(point); Mouse.Up(MouseButton.Left); using (var dlg = AutomationDialog.WaitForDialog(app)) { dlg.OK(); } Assert.IsNotNull(window.WaitForItem("Solution 'DragDropRelocatedTest' (1 project)", "DragDropTest", "SubItem.py")); app.Dte.Solution.Close(true); // Ensure file was moved and the path was updated correctly. var project = app.OpenProject(sln); foreach (var item in project.ProjectItems.OfType <OAFileItem>()) { Assert.IsTrue(File.Exists((string)item.Properties.Item("FullPath").Value), (string)item.Properties.Item("FullPath").Value); } }
internal static Project OpenDebuggerProject(VisualStudioApp app, string startItem = null) { var solutionPath = app.CopyProjectForTest(@"TestData\DebuggerProject.sln"); return(app.OpenProject(solutionPath, startItem)); }