本文整理汇总了C#中TestUtilities.UI.Python.PythonVisualStudioApp.GetInteractiveWindow方法的典型用法代码示例。如果您正苦于以下问题:C# PythonVisualStudioApp.GetInteractiveWindow方法的具体用法?C# PythonVisualStudioApp.GetInteractiveWindow怎么用?C# PythonVisualStudioApp.GetInteractiveWindow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestUtilities.UI.Python.PythonVisualStudioApp
的用法示例。
在下文中一共展示了PythonVisualStudioApp.GetInteractiveWindow方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CustomCommandsRunProcessInRepl
public void CustomCommandsRunProcessInRepl() {
using (var app = new PythonVisualStudioApp()) {
PythonProjectNode node;
EnvDTE.Project proj;
OpenProject(app, "Commands3.sln", out node, out proj);
Execute(node, "Write to Repl");
using (var repl = app.GetInteractiveWindow("Test Repl")) {
Assert.IsNotNull(repl, "Could not find repl window");
repl.WaitForTextEnd(
string.Format("({0}, {1})", PythonVersion.Configuration.Version.Major, PythonVersion.Configuration.Version.Minor),
">"
);
}
}
}
示例2: CustomCommandsRunInRepl
public void CustomCommandsRunInRepl() {
using (var app = new PythonVisualStudioApp()) {
PythonProjectNode node;
EnvDTE.Project proj;
OpenProject(app, "Commands1.sln", out node, out proj);
Execute(node, "Test Command 2");
using (var repl = app.GetInteractiveWindow("Test Repl")) {
Assert.IsNotNull(repl, "Could not find repl window");
repl.WaitForTextEnd(
"Program.py completed",
">"
);
}
app.Dte.Solution.Close();
using (var repl = app.GetInteractiveWindow("Test Repl")) {
Assert.IsNull(repl, "Repl window was not closed");
}
}
}
示例3: CustomCommandsReplWithResourceLabel
public void CustomCommandsReplWithResourceLabel() {
using (var app = new PythonVisualStudioApp()) {
PythonProjectNode node;
EnvDTE.Project proj;
OpenProject(app, "Commands2.sln", out node, out proj);
Execute(node, "Command from Resource");
using (var repl = app.GetInteractiveWindow("Repl from Resource")) {
Assert.IsNotNull(repl, "Could not find repl window");
repl.WaitForTextEnd(
"Program.py completed",
">"
);
}
using (var repl = app.GetInteractiveWindow("resource:PythonToolsUITests;PythonToolsUITests.Resources;ReplName")) {
Assert.IsNull(repl);
}
}
}
示例4: EnvironmentReplWorkingDirectoryTest
private void EnvironmentReplWorkingDirectoryTest(
PythonVisualStudioApp app,
EnvDTE.Project project,
TreeNode env,
string envName
) {
var path1 = Path.Combine(Path.GetDirectoryName(project.FullName), Guid.NewGuid().ToString("N"));
var path2 = Path.Combine(Path.GetDirectoryName(project.FullName), Guid.NewGuid().ToString("N"));
Directory.CreateDirectory(path1);
Directory.CreateDirectory(path2);
env.Select();
app.Dte.ExecuteCommand("Python.Interactive");
var window = app.GetInteractiveWindow(string.Format("{0} Interactive", envName));
Assert.IsNotNull(window, string.Format("Failed to find '{0} Interactive'", envName));
try {
app.ServiceProvider.GetUIThread().Invoke(() => project.GetPythonProject().SetProjectProperty("WorkingDirectory", path1));
window.Reset();
window.ReplWindow.Evaluator.ExecuteText("import os; os.getcwd()").Wait();
window.WaitForTextEnd(
string.Format("'{0}'", path1.Replace("\\", "\\\\")),
">>>"
);
app.ServiceProvider.GetUIThread().Invoke(() => project.GetPythonProject().SetProjectProperty("WorkingDirectory", path2));
window.Reset();
window.ReplWindow.Evaluator.ExecuteText("import os; os.getcwd()").Wait();
window.WaitForTextEnd(
string.Format("'{0}'", path2.Replace("\\", "\\\\")),
">>>"
);
} finally {
window.Close();
}
}
示例5: DjangoCollectStaticFilesCommand
public void DjangoCollectStaticFilesCommand() {
using (var app = new PythonVisualStudioApp()) {
var service = app.GetService<IComponentModel>(typeof(SComponentModel)).GetService<IInterpreterOptionsService>();
var envWithDjango = service.Interpreters.LastOrDefault(env => env.FindModulesAsync("django").WaitAndUnwrapExceptions().Contains("django"));
if (envWithDjango == null) {
Assert.Inconclusive("No available environments have Django installed");
}
using (var dis = new DefaultInterpreterSetter(envWithDjango)) {
var project = app.OpenProject("TestData\\DjangoApplication1\\DjangoApplication1.sln");
app.SolutionExplorerTreeView.SelectProject(project);
app.Dte.ExecuteCommand("Project.CollectStaticFiles");
var console = app.GetInteractiveWindow("Django Management Console - " + project.Name);
Assert.IsNotNull(console);
console.WaitForTextEnd("The Python REPL process has exited", ">>> ");
Assert.IsTrue(console.Text.Contains("0 static files copied"));
}
}
}
示例6: StartNewApp
public void StartNewApp() {
using (var app = new PythonVisualStudioApp()) {
var project = app.CreateProject(
PythonVisualStudioApp.TemplateLanguageName,
PythonVisualStudioApp.DjangoWebProjectTemplate,
TestData.GetTempPath(),
"StartNewApp"
);
app.SolutionExplorerTreeView.SelectProject(project);
using (var newAppDialog = NewAppDialog.FromDte(app)) {
newAppDialog.AppName = "Fob";
newAppDialog.OK();
}
app.SolutionExplorerTreeView.WaitForItem(
app.Dte.Solution.FullName,
app.Dte.Solution.Projects.Item(1).Name,
"Fob",
"models.py"
);
var appFolder = project.ProjectItems.Item("Fob");
Assert.IsNotNull(appFolder.Collection.Item("models.py"));
Assert.IsNotNull(appFolder.Collection.Item("tests.py"));
Assert.IsNotNull(appFolder.Collection.Item("views.py"));
Assert.IsNotNull(appFolder.Collection.Item("__init__.py"));
app.SolutionExplorerTreeView.SelectProject(project);
app.Dte.ExecuteCommand("Project.ValidateDjangoApp");
var console = app.GetInteractiveWindow("Django Management Console - " + project.Name);
Assert.IsNotNull(console);
console.WaitForTextEnd("Executing manage.py validate", "0 errors found", "The Python REPL process has exited", ">>> ");
app.SolutionExplorerTreeView.SelectProject(project);
using (var newItem = NewItemDialog.FromDte(app)) {
AutomationWrapper.Select(newItem.ProjectTypes.FindItem("HTML Page"));
newItem.FileName = "NewPage.html";
newItem.OK();
}
System.Threading.Thread.Sleep(1000);
Assert.IsNotNull(project.ProjectItems.Item("NewPage.html"));
}
}