mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 02:48:17 +00:00
Conditional imports (#11823)
## Summary Conditionally importing in tests to prevent unused imports warning in cargo test windows in CI.
This commit is contained in:
parent
7f4269ed08
commit
f9c1684b96
2 changed files with 16 additions and 6 deletions
|
@ -1,7 +1,15 @@
|
|||
#![allow(clippy::disallowed_types)]
|
||||
|
||||
#[cfg(feature = "git")]
|
||||
mod conditional_imports {
|
||||
pub(crate) use crate::common::{decode_token, READ_ONLY_GITHUB_TOKEN};
|
||||
pub(crate) use assert_cmd::assert::OutputAssertExt;
|
||||
}
|
||||
|
||||
#[cfg(feature = "git")]
|
||||
use conditional_imports::*;
|
||||
|
||||
use anyhow::Result;
|
||||
use assert_cmd::assert::OutputAssertExt;
|
||||
use assert_fs::prelude::*;
|
||||
use indoc::{formatdoc, indoc};
|
||||
use insta::assert_snapshot;
|
||||
|
@ -10,7 +18,7 @@ use uv_fs::Simplified;
|
|||
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{self, decode_token, packse_index_url, uv_snapshot, TestContext};
|
||||
use crate::common::{packse_index_url, uv_snapshot, TestContext};
|
||||
|
||||
/// Add a PyPI requirement.
|
||||
#[test]
|
||||
|
@ -322,7 +330,7 @@ fn add_git() -> Result<()> {
|
|||
#[cfg(feature = "git")]
|
||||
fn add_git_private_source() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let token = decode_token(common::READ_ONLY_GITHUB_TOKEN);
|
||||
let token = decode_token(READ_ONLY_GITHUB_TOKEN);
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! {r#"
|
||||
|
@ -427,7 +435,7 @@ fn add_git_private_source() -> Result<()> {
|
|||
#[cfg(feature = "git")]
|
||||
fn add_git_private_raw() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let token = decode_token(common::READ_ONLY_GITHUB_TOKEN);
|
||||
let token = decode_token(READ_ONLY_GITHUB_TOKEN);
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! {r#"
|
||||
|
|
|
@ -11,9 +11,11 @@ use indoc::indoc;
|
|||
use predicates::prelude::predicate;
|
||||
use url::Url;
|
||||
|
||||
#[cfg(feature = "git")]
|
||||
use crate::common::{self, decode_token};
|
||||
|
||||
use crate::common::{
|
||||
self, build_vendor_links_url, decode_token, get_bin, uv_snapshot, venv_bin_path,
|
||||
venv_to_interpreter, TestContext,
|
||||
build_vendor_links_url, get_bin, uv_snapshot, venv_bin_path, venv_to_interpreter, TestContext,
|
||||
};
|
||||
use uv_fs::Simplified;
|
||||
use uv_static::EnvVars;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue