fix: Separate Python version string and env name (#548)

This commit is contained in:
Nguyễn Hồng Quân 2019-10-17 16:55:48 +07:00 committed by Matan Kushner
parent e2e7277630
commit 27fad02837
2 changed files with 2 additions and 2 deletions

View File

@ -58,7 +58,7 @@ fn python_module(mut module: Module, pyenv_version_name: bool, python_version: S
let formatted_version = format_python_version(&python_version); let formatted_version = format_python_version(&python_version);
module.new_segment("version", &formatted_version); module.new_segment("version", &formatted_version);
get_python_virtual_env() get_python_virtual_env()
.map(|virtual_env| module.new_segment("virtualenv", &format!("({})", virtual_env))); .map(|virtual_env| module.new_segment("virtualenv", &format!(" ({})", virtual_env)));
}; };
module module

View File

@ -120,7 +120,7 @@ fn with_virtual_env() -> io::Result<()> {
.output()?; .output()?;
let actual = String::from_utf8(output.stdout).unwrap(); let actual = String::from_utf8(output.stdout).unwrap();
let expected = format!("via {} ", Color::Yellow.bold().paint("🐍 v3.7.4(my_venv)")); let expected = format!("via {} ", Color::Yellow.bold().paint("🐍 v3.7.4 (my_venv)"));
assert_eq!(expected, actual); assert_eq!(expected, actual);
Ok(()) Ok(())
} }