Пример #1
0
        public void AddFactories()
        {
            var mockService = new MockInterpreterOptionsService();

            using (var wpf = new WpfProxy())
                using (var list = wpf.Invoke(() => new EnvironmentListProxy(wpf))) {
                    var provider = new MockPythonInterpreterFactoryProvider("Test Provider 1",
                                                                            new MockPythonInterpreterFactory(Guid.NewGuid(), "Test Factory 1", MockInterpreterConfiguration(new Version(2, 7))),
                                                                            new MockPythonInterpreterFactory(Guid.NewGuid(), "Test Factory 2", MockInterpreterConfiguration(new Version(3, 0))),
                                                                            new MockPythonInterpreterFactory(Guid.NewGuid(), "Test Factory 3", MockInterpreterConfiguration(new Version(3, 3)))
                                                                            );

                    list.Service = mockService;

                    Assert.AreEqual(0, list.Environments.Count);

                    mockService.AddProvider(provider);
                    Assert.AreEqual(3, list.Environments.Count);
                    provider.AddFactory(new MockPythonInterpreterFactory(Guid.NewGuid(), "Test Factory 4", MockInterpreterConfiguration(new Version(2, 7))));
                    Assert.AreEqual(4, list.Environments.Count);
                    provider.AddFactory(new MockPythonInterpreterFactory(Guid.NewGuid(), "Test Factory 5", MockInterpreterConfiguration(new Version(3, 0))));
                    Assert.AreEqual(5, list.Environments.Count);
                    provider.AddFactory(new MockPythonInterpreterFactory(Guid.NewGuid(), "Test Factory 6", MockInterpreterConfiguration(new Version(3, 3))));
                    Assert.AreEqual(6, list.Environments.Count);
                }
        }
Пример #2
0
        public void HasInterpreters()
        {
            var sp          = new MockServiceProvider();
            var mockService = new MockInterpreterOptionsService();

            mockService.AddProvider(new MockPythonInterpreterFactoryProvider("Test Provider 1",
                                                                             new MockPythonInterpreterFactory(MockInterpreterConfiguration("Test Factory 1", new Version(2, 7))),
                                                                             new MockPythonInterpreterFactory(MockInterpreterConfiguration("Test Factory 2", new Version(3, 0))),
                                                                             new MockPythonInterpreterFactory(MockInterpreterConfiguration("Test Factory 3", new Version(3, 3)))
                                                                             ));
            mockService.AddProvider(new MockPythonInterpreterFactoryProvider("Test Provider 2",
                                                                             new MockPythonInterpreterFactory(MockInterpreterConfiguration("Test Factory 4", new Version(2, 7))),
                                                                             new MockPythonInterpreterFactory(MockInterpreterConfiguration("Test Factory 5", new Version(3, 0))),
                                                                             new MockPythonInterpreterFactory(MockInterpreterConfiguration("Test Factory 6", new Version(3, 3))),
                                                                             new MockPythonInterpreterFactory(MockInterpreterConfiguration("Test Factory 7", new Version(3, 3), InterpreterUIMode.Hidden))
                                                                             ));

            using (var wpf = new WpfProxy())
                using (var list = new EnvironmentListProxy(wpf)) {
                    list.Service      = mockService;
                    list.Interpreters = mockService;
                    var environments = list.Environments;

                    Assert.AreEqual(6, environments.Count);
                    AssertUtil.ContainsExactly(
                        wpf.Invoke(() => environments.Select(ev => ev.Description).ToList()),
                        "Test Factory 1 2.7",
                        "Test Factory 2 3.0",
                        "Test Factory 3 3.3",
                        "Test Factory 4 2.7",
                        "Test Factory 5 3.0",
                        "Test Factory 6 3.3"
                        );
                }
        }
Пример #3
0
        public void HasInterpreters()
        {
            var mockService = new MockInterpreterOptionsService();

            mockService.AddProvider(new MockPythonInterpreterFactoryProvider("Test Provider 1",
                                                                             new MockPythonInterpreterFactory(Guid.NewGuid(), "Test Factory 1", MockInterpreterConfiguration(new Version(2, 7))),
                                                                             new MockPythonInterpreterFactory(Guid.NewGuid(), "Test Factory 2", MockInterpreterConfiguration(new Version(3, 0))),
                                                                             new MockPythonInterpreterFactory(Guid.NewGuid(), "Test Factory 3", MockInterpreterConfiguration(new Version(3, 3)))
                                                                             ));
            mockService.AddProvider(new MockPythonInterpreterFactoryProvider("Test Provider 2",
                                                                             new MockPythonInterpreterFactory(Guid.NewGuid(), "Test Factory 4", MockInterpreterConfiguration(new Version(2, 7))),
                                                                             new MockPythonInterpreterFactory(Guid.NewGuid(), "Test Factory 5", MockInterpreterConfiguration(new Version(3, 0))),
                                                                             new MockPythonInterpreterFactory(Guid.NewGuid(), "Test Factory 6", MockInterpreterConfiguration(new Version(3, 3)))
                                                                             ));

            using (var wpf = new WpfProxy())
                using (var list = new EnvironmentListProxy(wpf)) {
                    list.Service = mockService;
                    var environments = list.Environments;

                    Assert.AreEqual(6, environments.Count);
                    AssertUtil.ContainsExactly(
                        wpf.Invoke(() => environments.Select(ev => ev.Description).ToList()),
                        Enumerable.Range(1, 6).Select(i => string.Format("Test Factory {0}", i))
                        );
                }
        }
Пример #4
0
        public void FactoryWithValidPath()
        {
            using (var wpf = new WpfProxy())
                using (var list = new EnvironmentListProxy(wpf)) {
                    var service  = new MockInterpreterOptionsService();
                    var provider = new MockPythonInterpreterFactoryProvider("Test Provider");
                    service.AddProvider(provider);
                    list.Service = service;

                    foreach (var version in PythonPaths.Versions)
                    {
                        Console.WriteLine("Path: <{0}>", version.InterpreterPath);
                        provider.RemoveAllFactories();
                        provider.AddFactory(new MockPythonInterpreterFactory(
                                                Guid.NewGuid(),
                                                "Test Factory",
                                                version.Configuration
                                                ));
                        var view = list.Environments.Single();
                        Assert.IsTrue(
                            list.CanExecute(DBExtension.StartRefreshDB, view),
                            string.Format("Cannot refresh DB for {0}", version.InterpreterPath)
                            );
                    }
                }
        }
Пример #5
0
        public void UnavailableEnvironments()
        {
            var collection = new Microsoft.Build.Evaluation.ProjectCollection();

            try {
                var service = new MockInterpreterOptionsService();
                var proj    = collection.LoadProject(TestData.GetPath(@"TestData\Environments\Unavailable.pyproj"));

                using (var provider = new MSBuildProjectInterpreterFactoryProvider(service, proj)) {
                    try {
                        provider.DiscoverInterpreters();
                        Assert.Fail("Expected InvalidDataException in DiscoverInterpreters");
                    } catch (InvalidDataException ex) {
                        AssertUtil.AreEqual(ex.Message
                                            .Replace(TestData.GetPath("TestData\\Environments\\"), "$")
                                            .Split('\r', '\n')
                                            .Where(s => !string.IsNullOrEmpty(s))
                                            .Select(s => s.Trim()),
                                            "Some project interpreters failed to load:",
                                            @"Interpreter $env\ has invalid value for 'Id': INVALID ID",
                                            @"Interpreter $env\ has invalid value for 'Version': INVALID VERSION",
                                            @"Base interpreter $env\ has invalid value for 'BaseInterpreter': INVALID BASE",
                                            @"Interpreter $env\ has invalid value for 'InterpreterPath': INVALID<>PATH",
                                            @"Interpreter $env\ has invalid value for 'WindowsInterpreterPath': INVALID<>PATH",
                                            @"Interpreter $env\ has invalid value for 'LibraryPath': INVALID<>PATH",
                                            @"Base interpreter $env\ has invalid value for 'BaseInterpreter': {98512745-4ac7-4abb-9f33-120af32edc77}"
                                            );
                    }

                    var factories = provider.GetInterpreterFactories().ToList();
                    foreach (var fact in factories)
                    {
                        Console.WriteLine("{0}: {1}", fact.GetType().FullName, fact.Description);
                    }

                    foreach (var fact in factories)
                    {
                        Assert.IsInstanceOfType(
                            fact,
                            typeof(MSBuildProjectInterpreterFactoryProvider.NotFoundInterpreterFactory),
                            string.Format("{0} was not correct type", fact.Description)
                            );
                        Assert.IsFalse(provider.IsAvailable(fact), string.Format("{0} was not unavailable", fact.Description));
                    }

                    AssertUtil.AreEqual(factories.Select(f => f.Description),
                                        "Invalid BaseInterpreter (unavailable)",
                                        "Invalid InterpreterPath (unavailable)",
                                        "Invalid WindowsInterpreterPath (unavailable)",
                                        "Invalid LibraryPath (unavailable)",
                                        "Absent BaseInterpreter (unavailable)",
                                        "Unknown Python 2.7"
                                        );
                }
            } finally {
                collection.UnloadAllProjects();
                collection.Dispose();
            }
        }
Пример #6
0
        private MockInterpreterOptionsService MakeEmptyVEnv()
        {
            var python = PythonPaths.Versions.FirstOrDefault(p =>
                                                             p.IsCPython && Directory.Exists(Path.Combine(p.LibPath, "venv"))
                                                             );

            if (python == null)
            {
                Assert.Inconclusive("Requires Python with venv");
            }

            var env = TestData.GetTempPath(randomSubPath: true);

            if (env.Length > 140)
            {
                env = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
                DeleteFolder.Add(env);
            }
            using (var proc = ProcessOutput.RunHiddenAndCapture(
                       python.InterpreterPath, "-m", "venv", env, "--clear"
                       )) {
                Console.WriteLine(proc.Arguments);
                proc.Wait();
                foreach (var line in proc.StandardOutputLines.Concat(proc.StandardErrorLines))
                {
                    Console.WriteLine(line);
                }
                Assert.AreEqual(0, proc.ExitCode ?? -1, "Failed to create venv");
            }

            // Forcibly remove pip so we can reinstall it
            foreach (var dir in Directory.EnumerateDirectories(Path.Combine(env, "lib", "site-packages")))
            {
                Directory.Delete(dir, true);
            }

            var service  = new MockInterpreterOptionsService();
            var provider = new MockPythonInterpreterFactoryProvider("VEnv Provider");

            provider.AddFactory(new MockPythonInterpreterFactory(
                                    new InterpreterConfiguration(
                                        "Mock;" + Guid.NewGuid().ToString(),
                                        Path.GetFileName(PathUtils.TrimEndSeparator(env)),
                                        env,
                                        PathUtils.FindFile(env, "python.exe"),
                                        PathUtils.FindFile(env, "python.exe"),
                                        Path.GetDirectoryName(PathUtils.FindFile(env, "site.py", 3)),
                                        "PYTHONPATH",
                                        python.Isx64 ? ProcessorArchitecture.Amd64 : ProcessorArchitecture.X86,
                                        python.Version.ToVersion()
                                        )
                                    ));
            service.AddProvider(provider);
            return(service);
        }
Пример #7
0
        public void UnavailableEnvironments()
        {
            var collection = new Microsoft.Build.Evaluation.ProjectCollection();

            try {
                var service         = new MockInterpreterOptionsService();
                var proj            = collection.LoadProject(TestData.GetPath(@"TestData\Environments\Unavailable.pyproj"));
                var contextProvider = new MockProjectContextProvider(proj);

                var logger = new MockLogger();

                using (var provider = new MSBuildProjectInterpreterFactoryProvider(
                           new[] { new Lazy <IProjectContextProvider>(() => contextProvider) },
                           null,
                           new[] { new Lazy <IInterpreterLog>(() => logger) })) {
                    var configs = provider.GetInterpreterConfigurations().ToArray();
                    // force the load...
                    AssertUtil.AreEqual(
                        logger.Errors.ToString()
                        .Replace(TestData.GetPath("TestData\\Environments\\"), "$")
                        .Split('\r', '\n')
                        .Where(s => !string.IsNullOrEmpty(s))
                        .Select(s => s.Trim()),
                        @"Interpreter $env\ has invalid value for 'Id':",
                        @"Interpreter $env\ has invalid value for 'Version': INVALID VERSION",
                        @"Interpreter $env\ has invalid value for 'InterpreterPath': INVALID<>PATH",
                        @"Interpreter $env\ has invalid value for 'WindowsInterpreterPath': INVALID<>PATH"
                        );

                    var factories = provider.GetInterpreterFactories().ToList();
                    foreach (var fact in factories)
                    {
                        Console.WriteLine("{0}: {1}", fact.GetType().FullName, fact.Configuration.Description);
                    }

                    foreach (var fact in factories)
                    {
                        Assert.IsInstanceOfType(
                            fact,
                            typeof(NotFoundInterpreterFactory),
                            string.Format("{0} was not correct type", fact.Configuration.Description)
                            );
                        Assert.IsFalse(fact.Configuration.IsAvailable(), string.Format("{0} was not unavailable", fact.Configuration.Description));
                    }

                    AssertUtil.AreEqual(factories.Select(f => f.Configuration.Description),
                                        "Invalid InterpreterPath (unavailable)",
                                        "Invalid WindowsInterpreterPath (unavailable)"
                                        );
                }
            } finally {
                collection.UnloadAllProjects();
                collection.Dispose();
            }
        }
Пример #8
0
        private static async Task <VsProjectAnalyzer> CreateAnalyzerAsync(PythonVersion version)
        {
            version.AssertInstalled();
            var factory      = new MockPythonInterpreterFactory(version.Configuration);
            var sp           = new MockServiceProvider();
            var services     = new Microsoft.PythonTools.Editor.PythonEditorServices(sp);
            var interpreters = new MockInterpreterOptionsService();

            interpreters.AddProvider(new MockPythonInterpreterFactoryProvider("Test Provider", factory));
            services.InterpreterRegistryService = interpreters;
            services.InterpreterOptionsService  = interpreters;
            return(await VsProjectAnalyzer.CreateForTestsAsync(
                       services,
                       factory
                       ));
        }
Пример #9
0
        public void LoadUnloadProjectFactories()
        {
            var service      = new MockInterpreterOptionsService();
            var mockProvider = new MockPythonInterpreterFactoryProvider("Test Provider");

            mockProvider.AddFactory(new MockPythonInterpreterFactory(Guid.NewGuid(), "Test Environment", MockInterpreterConfiguration(new Version(2, 7))));
            service.AddProvider(mockProvider);

            var loaded = new LoadedProjectInterpreterFactoryProvider();

            service.AddProvider(loaded);
            using (var wpf = new WpfProxy())
                using (var list = new EnvironmentListProxy(wpf)) {
                    list.Service = service;

                    // List only contains one entry
                    AssertUtil.ContainsExactly(
                        wpf.Invoke(() => list.Environments.Select(ev => ev.Description).ToList()),
                        "Test Environment"
                        );

                    var project = new MockPythonInterpreterFactoryProvider("Fake Project");
                    project.AddFactory(new MockPythonInterpreterFactory(Guid.NewGuid(), "Fake Environment", MockInterpreterConfiguration(new Version(2, 7))));

                    loaded.ProjectLoaded(project, null);

                    // List now contains two entries
                    AssertUtil.ContainsExactly(
                        wpf.Invoke(() => list.Environments.Select(ev => ev.Description).ToList()),
                        "Test Environment",
                        "Fake Environment"
                        );

                    loaded.ProjectUnloaded(project);

                    // List only has one entry again
                    AssertUtil.ContainsExactly(
                        wpf.Invoke(() => list.Environments.Select(ev => ev.Description).ToList()),
                        "Test Environment"
                        );
                }
        }
Пример #10
0
        public void FactoryWithInvalidPath()
        {
            using (var wpf = new WpfProxy())
                using (var list = new EnvironmentListProxy(wpf)) {
                    var service  = new MockInterpreterOptionsService();
                    var provider = new MockPythonInterpreterFactoryProvider("Test Provider");
                    service.AddProvider(provider);
                    list.Service      = service;
                    list.Interpreters = service;

                    foreach (string invalidPath in new string[] {
                        null,
                        "",
                        "NOT A REAL PATH",
                        string.Join("\\", Path.GetInvalidPathChars().Select(c => c.ToString()))
                    })
                    {
                        Console.WriteLine("Path: <{0}>", invalidPath ?? "(null)");
                        provider.RemoveAllFactories();
                        provider.AddFactory(new MockPythonInterpreterFactory(
                                                new InterpreterConfiguration(
                                                    "Mock;" + Guid.NewGuid().ToString(),
                                                    "Test Factory",
                                                    invalidPath,
                                                    invalidPath,
                                                    "",
                                                    "",
                                                    "",
                                                    ProcessorArchitecture.None,
                                                    new Version(2, 7)
                                                    )
                                                ));
                        var view = list.Environments.Single();
                        Assert.IsFalse(
                            list.CanExecute(DBExtension.StartRefreshDB, view),
                            string.Format("Should not be able to refresh DB for {0}", invalidPath)
                            );
                    }
                }
        }
Пример #11
0
        public void AddRemoveProjectFactories()
        {
            var service = new MockInterpreterOptionsService();
            var loaded  = new LoadedProjectInterpreterFactoryProvider();

            service.AddProvider(loaded);
            using (var wpf = new WpfProxy())
                using (var list = new EnvironmentListProxy(wpf)) {
                    list.Service = service;

                    // List should be empty
                    AssertUtil.ContainsExactly(list.Environments);

                    var project = new MockPythonInterpreterFactoryProvider("Fake Project");

                    loaded.ProjectLoaded(project, null);

                    // List is still empty
                    AssertUtil.ContainsExactly(list.Environments);

                    project.AddFactory(new MockPythonInterpreterFactory(Guid.NewGuid(), "Fake Environment", MockInterpreterConfiguration(new Version(2, 7))));

                    // List now contains one project
                    AssertUtil.ContainsExactly(
                        wpf.Invoke(() => list.Environments.Select(ev => ev.Description).ToList()),
                        "Fake Environment"
                        );

                    project.RemoveAllFactories();

                    // List is empty again
                    AssertUtil.ContainsExactly(list.Environments);

                    loaded.ProjectUnloaded(project);
                }
        }
Пример #12
0
        public void RefreshDBStates()
        {
            using (var fact = new MockPythonInterpreterFactory(
                       Guid.NewGuid(),
                       "Test Factory 1",
                       MockInterpreterConfiguration(
                           PythonPaths.Versions.First().InterpreterPath
                           ),
                       true
                       ))
                using (var wpf = new WpfProxy())
                    using (var list = new EnvironmentListProxy(wpf)) {
                        list.CreateDBExtension = true;

                        var mockService = new MockInterpreterOptionsService();
                        mockService.AddProvider(new MockPythonInterpreterFactoryProvider("Test Provider 1", fact));
                        list.Service = mockService;
                        var view = list.Environments.Single();

                        Assert.IsFalse(wpf.Invoke(() => view.IsRefreshingDB));
                        Assert.IsTrue(list.CanExecute(DBExtension.StartRefreshDB, view));
                        Assert.IsFalse(fact.IsCurrent);
                        Assert.AreEqual(MockPythonInterpreterFactory.NoDatabaseReason, fact.GetIsCurrentReason(null));

                        list.Execute(DBExtension.StartRefreshDB, view).GetAwaiter().GetResult();
                        for (int retries = 10; retries > 0 && !wpf.Invoke(() => view.IsRefreshingDB); --retries)
                        {
                            Thread.Sleep(200);
                        }

                        Assert.IsTrue(wpf.Invoke(() => view.IsRefreshingDB));
                        Assert.IsFalse(list.CanExecute(DBExtension.StartRefreshDB, view));
                        Assert.IsFalse(fact.IsCurrent);
                        Assert.AreEqual(MockPythonInterpreterFactory.GeneratingReason, fact.GetIsCurrentReason(null));

                        fact.EndGenerateCompletionDatabase(AnalyzerStatusUpdater.GetIdentifier(fact), false);
                        for (int retries = 10; retries > 0 && wpf.Invoke(() => view.IsRefreshingDB); --retries)
                        {
                            Thread.Sleep(1000);
                        }

                        Assert.IsFalse(wpf.Invoke(() => view.IsRefreshingDB));
                        Assert.IsTrue(list.CanExecute(DBExtension.StartRefreshDB, view));
                        Assert.IsFalse(fact.IsCurrent);
                        Assert.AreEqual(MockPythonInterpreterFactory.MissingModulesReason, fact.GetIsCurrentReason(null));

                        list.Execute(DBExtension.StartRefreshDB, view).GetAwaiter().GetResult();

                        Assert.IsTrue(wpf.Invoke(() => view.IsRefreshingDB));
                        Assert.IsFalse(list.CanExecute(DBExtension.StartRefreshDB, view));
                        Assert.IsFalse(fact.IsCurrent);
                        Assert.AreEqual(MockPythonInterpreterFactory.GeneratingReason, fact.GetIsCurrentReason(null));

                        fact.EndGenerateCompletionDatabase(AnalyzerStatusUpdater.GetIdentifier(fact), true);
                        for (int retries = 10; retries > 0 && wpf.Invoke(() => view.IsRefreshingDB); --retries)
                        {
                            Thread.Sleep(1000);
                        }

                        Assert.IsFalse(wpf.Invoke(() => view.IsRefreshingDB));
                        Assert.IsTrue(list.CanExecute(DBExtension.StartRefreshDB, view));
                        Assert.IsTrue(fact.IsCurrent);
                        Assert.AreEqual(MockPythonInterpreterFactory.UpToDateReason, fact.GetIsCurrentReason(null));
                        Assert.AreEqual(MockPythonInterpreterFactory.UpToDateReason, fact.GetIsCurrentReason(null));
                    }
        }
Пример #13
0
        private void ImportWizardVirtualEnvWorker(
            PythonVersion python,
            string venvModuleName,
            string expectedFile,
            bool brokenBaseInterpreter
            )
        {
            var mockService = new MockInterpreterOptionsService();

            mockService.AddProvider(new MockPythonInterpreterFactoryProvider("Test Provider",
                                                                             new MockPythonInterpreterFactory(python.Configuration)
                                                                             ));

            using (var wpf = new WpfProxy()) {
                var settings   = wpf.Create(() => new ImportSettings(null, mockService));
                var sourcePath = TestData.GetTempPath(randomSubPath: true);
                // Create a fake set of files to import
                File.WriteAllText(Path.Combine(sourcePath, "main.py"), "");
                Directory.CreateDirectory(Path.Combine(sourcePath, "A"));
                File.WriteAllText(Path.Combine(sourcePath, "A", "__init__.py"), "");
                // Create a real virtualenv environment to import
                using (var p = ProcessOutput.RunHiddenAndCapture(python.InterpreterPath, "-m", venvModuleName, Path.Combine(sourcePath, "env"))) {
                    Console.WriteLine(p.Arguments);
                    p.Wait();
                    Console.WriteLine(string.Join(Environment.NewLine, p.StandardOutputLines.Concat(p.StandardErrorLines)));
                    Assert.AreEqual(0, p.ExitCode);
                }

                if (brokenBaseInterpreter)
                {
                    var cfgPath = Path.Combine(sourcePath, "env", "Lib", "orig-prefix.txt");
                    if (File.Exists(cfgPath))
                    {
                        File.WriteAllText(cfgPath, string.Format("C:\\{0:N}", Guid.NewGuid()));
                    }
                    else if (File.Exists((cfgPath = Path.Combine(sourcePath, "env", "pyvenv.cfg"))))
                    {
                        File.WriteAllLines(cfgPath, File.ReadAllLines(cfgPath)
                                           .Select(line => {
                            if (line.StartsWith("home = "))
                            {
                                return(string.Format("home = C:\\{0:N}", Guid.NewGuid()));
                            }
                            return(line);
                        })
                                           );
                    }
                }

                Console.WriteLine("All files:");
                foreach (var f in Directory.EnumerateFiles(sourcePath, "*", SearchOption.AllDirectories))
                {
                    Console.WriteLine(PathUtils.GetRelativeFilePath(sourcePath, f));
                }

                Assert.IsTrue(
                    File.Exists(Path.Combine(sourcePath, "env", expectedFile)),
                    "Virtualenv was not created correctly"
                    );

                settings.SourcePath = sourcePath;

                string path = CreateRequestedProject(settings);

                Assert.AreEqual(settings.ProjectPath, path);
                var proj = XDocument.Load(path);

                // Does not include any .py files from the virtualenv
                AssertUtil.ContainsExactly(proj.Descendants(proj.GetName("Compile")).Select(x => x.Attribute("Include").Value),
                                           "main.py",
                                           "A\\__init__.py"
                                           );
                // Does not contain 'env'
                AssertUtil.ContainsExactly(proj.Descendants(proj.GetName("Folder")).Select(x => x.Attribute("Include").Value),
                                           "A"
                                           );

                var env = proj.Descendants(proj.GetName("Interpreter")).SingleOrDefault();
                if (brokenBaseInterpreter)
                {
                    Assert.IsNull(env);
                }
                else
                {
                    Assert.AreEqual("env\\", env.Attribute("Include").Value);
                    Assert.AreNotEqual("", env.Descendant("Id").Value);
                    Assert.AreEqual(string.Format("env ({0})", python.Configuration.Description), env.Descendant("Description").Value);
                    Assert.AreEqual("scripts\\python.exe", env.Descendant("InterpreterPath").Value, true);
                    Assert.AreEqual("scripts\\pythonw.exe", env.Descendant("WindowsInterpreterPath").Value, true);
                    Assert.AreEqual("PYTHONPATH", env.Descendant("PathEnvironmentVariable").Value, true);
                    Assert.AreEqual(python.Configuration.Version.ToString(), env.Descendant("Version").Value, true);
                    Assert.AreEqual(python.Configuration.Architecture.ToString("X"), env.Descendant("Architecture").Value, true);
                }
            }
        }