Ejemplo n.º 1
0
        public void AddExistingVEnv() {
            var python = PythonPaths.Python35 ?? PythonPaths.Python34 ?? PythonPaths.Python33;
            python.AssertInstalled();

            using (var app = new PythonVisualStudioApp()) {
                var project = CreateTemporaryProject(app);

                string envName;
                var envPath = TestData.GetPath(@"TestData\\Environments\\venv");
                File.WriteAllText(Path.Combine(envPath, "pyvenv.cfg"),
                    string.Format(@"home = {0}
include-system-site-packages = false
version = 3.{1}.0", python.PrefixPath, python.Version.ToVersion().Minor));

                var env = app.AddExistingVirtualEnvironment(project, envPath, out envName);
                Assert.IsNotNull(env);
                Assert.IsNotNull(env.Element);
                Assert.AreEqual(
                    string.Format("venv (Python 3.{0})", python.Version.ToVersion().Minor),
                    envName
                );
            }
        }