mirror of
https://github.com/Llewellynvdm/starship.git
synced 2024-11-25 06:07:43 +00:00
055986e2b1
* Add option to change the python binary We are going to start to have problems with the python binary as python2 is removed and replaced with python3. To make the transition easier I have added an option to the python module to allow the user to pick a particular binary, e.g `python3`, for the module to use when selecting the version of python. I have also refactored the python tests moving almost all of them into the module and removing the dependency on the version of python that is installed on the system. * Add advanced config section to python module docs Have added an advanced config section to the python module docs and moved the `python_binary` option into that section.
38 lines
966 B
Rust
38 lines
966 B
Rust
use std::fs::File;
|
|
use std::io;
|
|
|
|
use crate::common;
|
|
|
|
// TODO - These tests should be moved into the python module when we have sorted out mocking of env
|
|
// vars.
|
|
|
|
#[test]
|
|
fn with_virtual_env() -> io::Result<()> {
|
|
let dir = tempfile::tempdir()?;
|
|
File::create(dir.path().join("main.py"))?.sync_all()?;
|
|
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();
|
|
|
|
assert!(actual.contains("my_venv"));
|
|
dir.close()
|
|
}
|
|
|
|
#[test]
|
|
fn with_active_venv() -> io::Result<()> {
|
|
let dir = tempfile::tempdir()?;
|
|
|
|
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();
|
|
|
|
assert!(actual.contains("my_venv"));
|
|
dir.close()
|
|
}
|