2019-06-06 14:18:00 +02:00
|
|
|
use std::fs::File;
|
|
|
|
use std::io;
|
|
|
|
|
2019-08-11 23:51:13 +02:00
|
|
|
use ansi_term::Color;
|
|
|
|
|
2019-06-06 14:18:00 +02:00
|
|
|
use crate::common;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[ignore]
|
|
|
|
fn folder_with_python_version() -> io::Result<()> {
|
|
|
|
let dir = common::new_tempdir()?;
|
|
|
|
File::create(dir.path().join(".python-version"))?;
|
|
|
|
|
|
|
|
let output = common::render_module("python")
|
|
|
|
.arg("--path")
|
|
|
|
.arg(dir.path())
|
|
|
|
.output()?;
|
|
|
|
let actual = String::from_utf8(output.stdout).unwrap();
|
|
|
|
|
2019-07-19 21:56:36 +02:00
|
|
|
let expected = format!("via {} ", Color::Yellow.bold().paint("🐍 v3.6.9"));
|
2019-06-06 14:18:00 +02:00
|
|
|
assert_eq!(expected, actual);
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[ignore]
|
|
|
|
fn folder_with_requirements_txt() -> io::Result<()> {
|
|
|
|
let dir = common::new_tempdir()?;
|
|
|
|
File::create(dir.path().join("requirements.txt"))?;
|
|
|
|
|
|
|
|
let output = common::render_module("python")
|
|
|
|
.arg("--path")
|
|
|
|
.arg(dir.path())
|
|
|
|
.output()?;
|
|
|
|
let actual = String::from_utf8(output.stdout).unwrap();
|
|
|
|
|
2019-07-19 21:56:36 +02:00
|
|
|
let expected = format!("via {} ", Color::Yellow.bold().paint("🐍 v3.6.9"));
|
2019-06-06 14:18:00 +02:00
|
|
|
assert_eq!(expected, actual);
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[ignore]
|
|
|
|
fn folder_with_pyproject_toml() -> io::Result<()> {
|
|
|
|
let dir = common::new_tempdir()?;
|
|
|
|
File::create(dir.path().join("pyproject.toml"))?;
|
|
|
|
|
|
|
|
let output = common::render_module("python")
|
|
|
|
.arg("--path")
|
|
|
|
.arg(dir.path())
|
|
|
|
.output()?;
|
|
|
|
let actual = String::from_utf8(output.stdout).unwrap();
|
|
|
|
|
2019-07-19 21:56:36 +02:00
|
|
|
let expected = format!("via {} ", Color::Yellow.bold().paint("🐍 v3.6.9"));
|
2019-06-06 14:18:00 +02:00
|
|
|
assert_eq!(expected, actual);
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
2019-08-22 00:54:22 +02:00
|
|
|
#[test]
|
|
|
|
#[ignore]
|
|
|
|
fn folder_with_pipfile() -> io::Result<()> {
|
|
|
|
let dir = common::new_tempdir()?;
|
|
|
|
File::create(dir.path().join("Pipfile"))?;
|
|
|
|
|
|
|
|
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);
|
2019-09-15 18:21:40 +02:00
|
|
|
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);
|
2019-08-22 00:54:22 +02:00
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
2019-06-06 14:18:00 +02:00
|
|
|
#[test]
|
|
|
|
#[ignore]
|
|
|
|
fn folder_with_py_file() -> io::Result<()> {
|
|
|
|
let dir = common::new_tempdir()?;
|
|
|
|
File::create(dir.path().join("main.py"))?;
|
|
|
|
|
|
|
|
let output = common::render_module("python")
|
|
|
|
.arg("--path")
|
|
|
|
.arg(dir.path())
|
|
|
|
.output()?;
|
|
|
|
let actual = String::from_utf8(output.stdout).unwrap();
|
|
|
|
|
2019-07-19 21:56:36 +02:00
|
|
|
let expected = format!("via {} ", Color::Yellow.bold().paint("🐍 v3.6.9"));
|
2019-06-06 14:18:00 +02:00
|
|
|
assert_eq!(expected, actual);
|
|
|
|
Ok(())
|
|
|
|
}
|
2019-08-11 23:51:13 +02:00
|
|
|
|
|
|
|
#[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();
|
|
|
|
|
2019-09-27 05:18:24 +02:00
|
|
|
let expected = format!("via {} ", Color::Yellow.bold().paint("🐍 v3.6.9(my_venv)"));
|
2019-08-11 23:51:13 +02:00
|
|
|
assert_eq!(expected, actual);
|
|
|
|
Ok(())
|
|
|
|
}
|