feat: Implement Python virtual environment display (#137)

This commit is contained in:
MaT1g3R
2019-08-11 17:51:13 -04:00
committed by Matan Kushner
parent 53f8ed1cd6
commit 3669e389b6
4 changed files with 51 additions and 3 deletions
+23 -1
View File
@@ -1,7 +1,9 @@
use ansi_term::Color;
use std::env;
use std::fs::File;
use std::io;
use ansi_term::Color;
use crate::common;
#[test]
@@ -71,3 +73,23 @@ fn folder_with_py_file() -> io::Result<()> {
assert_eq!(expected, actual);
Ok(())
}
#[test]
#[ignore]
fn with_virtual_env() -> io::Result<()> {
let dir = common::new_tempdir()?;
File::create(dir.path().join("main.py"))?;
let output = common::render_module("python")
.env("VIRTUAL_ENV", "/foo/bar/my_venv")
.arg("--path")
.arg(dir.path())
.output()?;
let actual = String::from_utf8(output.stdout).unwrap();
let expected = format!(
"via {} ",
Color::Yellow.bold().paint("🐍 v3.6.9(my_venv)")
);
assert_eq!(expected, actual);
Ok(())
}