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:
parent
36354aaa79
commit
653def05f0
|
@ -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
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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<()> {
|
||||
|
|
Loading…
Reference in New Issue