mirror of
https://github.com/Llewellynvdm/starship.git
synced 2024-12-30 20:59:13 +00:00
8f645ffb8a
* ci: Replace setup-ruby with use-ruby-action * ci: Update python version * ci: Update Ruby version * Set ruby action to master * Try installing mercurial earlier in the workflow * Remove mercurial installation * Remove mercurial installation on all OSes * Revert "Remove mercurial installation on all OSes" This reverts commit 0e1a3e7e928198ece34660494980f00102df8c45. * Update hg installation comment * Revert Ruby update * Add caching * Add caching to audit * Update workflow.yml * Only cache during test steps
144 lines
3.8 KiB
Rust
144 lines
3.8 KiB
Rust
use std::fs::File;
|
|
use std::io;
|
|
|
|
use ansi_term::Color;
|
|
use tempfile;
|
|
|
|
use crate::common;
|
|
|
|
#[test]
|
|
#[ignore]
|
|
fn folder_with_python_version() -> io::Result<()> {
|
|
let dir = tempfile::tempdir()?;
|
|
File::create(dir.path().join(".python-version"))?.sync_all()?;
|
|
|
|
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.7.6"));
|
|
assert_eq!(expected, actual);
|
|
Ok(())
|
|
}
|
|
|
|
#[test]
|
|
#[ignore]
|
|
fn folder_with_requirements_txt() -> io::Result<()> {
|
|
let dir = tempfile::tempdir()?;
|
|
File::create(dir.path().join("requirements.txt"))?.sync_all()?;
|
|
|
|
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.7.6"));
|
|
assert_eq!(expected, actual);
|
|
Ok(())
|
|
}
|
|
|
|
#[test]
|
|
#[ignore]
|
|
fn folder_with_pyproject_toml() -> io::Result<()> {
|
|
let dir = tempfile::tempdir()?;
|
|
File::create(dir.path().join("pyproject.toml"))?.sync_all()?;
|
|
|
|
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.7.6"));
|
|
assert_eq!(expected, actual);
|
|
Ok(())
|
|
}
|
|
|
|
#[test]
|
|
#[ignore]
|
|
fn folder_with_pipfile() -> io::Result<()> {
|
|
let dir = tempfile::tempdir()?;
|
|
File::create(dir.path().join("Pipfile"))?.sync_all()?;
|
|
|
|
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.7.6"));
|
|
assert_eq!(expected, actual);
|
|
Ok(())
|
|
}
|
|
|
|
#[test]
|
|
#[ignore]
|
|
fn folder_with_tox() -> io::Result<()> {
|
|
let dir = tempfile::tempdir()?;
|
|
File::create(dir.path().join("tox.ini"))?.sync_all()?;
|
|
|
|
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.7.6"));
|
|
assert_eq!(expected, actual);
|
|
Ok(())
|
|
}
|
|
|
|
#[test]
|
|
#[ignore]
|
|
fn folder_with_py_file() -> io::Result<()> {
|
|
let dir = tempfile::tempdir()?;
|
|
File::create(dir.path().join("main.py"))?.sync_all()?;
|
|
|
|
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.7.6"));
|
|
assert_eq!(expected, actual);
|
|
Ok(())
|
|
}
|
|
|
|
#[test]
|
|
#[ignore]
|
|
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();
|
|
|
|
let expected = format!("via {} ", Color::Yellow.bold().paint("🐍 v3.7.6 (my_venv)"));
|
|
assert_eq!(expected, actual);
|
|
Ok(())
|
|
}
|
|
|
|
#[test]
|
|
#[ignore]
|
|
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();
|
|
|
|
let expected = format!("via {} ", Color::Yellow.bold().paint("🐍 v3.7.6 (my_venv)"));
|
|
assert_eq!(expected, actual);
|
|
Ok(())
|
|
}
|