1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-06-20 17:12:28 +00:00

Enable the python module for tox files (#369)

Enable the python module if the current directory contains a `tox.ini`
file.
This commit is contained in:
Thomas O'Donnell 2019-09-15 18:21:40 +02:00 committed by Matan Kushner
parent 36354aaa79
commit 653def05f0
3 changed files with 20 additions and 0 deletions

View File

@ -568,6 +568,7 @@ The module will be shown if any of the following conditions are met:
- The current directory contains a `pyproject.toml` file
- The current directory contains a file with the `.py` extension
- The current directory contains a `Pipfile` file
- The current directory contains a `tox.ini` file
### Options

View File

@ -14,6 +14,7 @@ use super::{Context, Module};
/// - Current directory contains a `pyproject.toml` file
/// - Current directory contains a file with the `.py` extension
/// - Current directory contains a `Pipfile` file
/// - Current directory contains a `tox.ini` file
pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
let is_py_project = context
.try_begin_scan()?
@ -22,6 +23,7 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
".python-version",
"pyproject.toml",
"Pipfile",
"tox.ini",
])
.set_extensions(&["py"])
.is_match();

View File

@ -73,6 +73,23 @@ fn folder_with_pipfile() -> io::Result<()> {
Ok(())
}
#[test]
#[ignore]
fn folder_with_tox() -> io::Result<()> {
let dir = common::new_tempdir()?;
File::create(dir.path().join("tox.ini"))?;
let output = common::render_module("python")
.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"));
assert_eq!(expected, actual);
Ok(())
}
#[test]
#[ignore]
fn folder_with_py_file() -> io::Result<()> {