mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 19:08:04 +00:00
chore: Move all integration tests to a single binary (#8093)
As per https://matklad.github.io/2021/02/27/delete-cargo-integration-tests.html Before that, there were 91 separate integration tests binary. (As discussed on Discord — I've done the `uv` crate, there's still a few more commits coming before this is mergeable, and I want to see how it performs in CI and locally).
This commit is contained in:
parent
fce7a838e9
commit
715f28fd39
231 changed files with 15585 additions and 15507 deletions
|
@ -9,6 +9,9 @@ repository = { workspace = true }
|
|||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
|
|
|
@ -397,108 +397,4 @@ impl<'de> serde::de::Deserialize<'de> for PortablePathBuf {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_normalize_url() {
|
||||
if cfg!(windows) {
|
||||
assert_eq!(
|
||||
normalize_url_path("/C:/Users/ferris/wheel-0.42.0.tar.gz"),
|
||||
"C:\\Users\\ferris\\wheel-0.42.0.tar.gz"
|
||||
);
|
||||
} else {
|
||||
assert_eq!(
|
||||
normalize_url_path("/C:/Users/ferris/wheel-0.42.0.tar.gz"),
|
||||
"/C:/Users/ferris/wheel-0.42.0.tar.gz"
|
||||
);
|
||||
}
|
||||
|
||||
if cfg!(windows) {
|
||||
assert_eq!(
|
||||
normalize_url_path("./ferris/wheel-0.42.0.tar.gz"),
|
||||
".\\ferris\\wheel-0.42.0.tar.gz"
|
||||
);
|
||||
} else {
|
||||
assert_eq!(
|
||||
normalize_url_path("./ferris/wheel-0.42.0.tar.gz"),
|
||||
"./ferris/wheel-0.42.0.tar.gz"
|
||||
);
|
||||
}
|
||||
|
||||
if cfg!(windows) {
|
||||
assert_eq!(
|
||||
normalize_url_path("./wheel%20cache/wheel-0.42.0.tar.gz"),
|
||||
".\\wheel cache\\wheel-0.42.0.tar.gz"
|
||||
);
|
||||
} else {
|
||||
assert_eq!(
|
||||
normalize_url_path("./wheel%20cache/wheel-0.42.0.tar.gz"),
|
||||
"./wheel cache/wheel-0.42.0.tar.gz"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_normalize_path() {
|
||||
let path = Path::new("/a/b/../c/./d");
|
||||
let normalized = normalize_absolute_path(path).unwrap();
|
||||
assert_eq!(normalized, Path::new("/a/c/d"));
|
||||
|
||||
let path = Path::new("/a/../c/./d");
|
||||
let normalized = normalize_absolute_path(path).unwrap();
|
||||
assert_eq!(normalized, Path::new("/c/d"));
|
||||
|
||||
// This should be an error.
|
||||
let path = Path::new("/a/../../c/./d");
|
||||
let err = normalize_absolute_path(path).unwrap_err();
|
||||
assert_eq!(err.kind(), std::io::ErrorKind::InvalidInput);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_relative_to() {
|
||||
assert_eq!(
|
||||
relative_to(
|
||||
Path::new("/home/ferris/carcinization/lib/python/site-packages/foo/__init__.py"),
|
||||
Path::new("/home/ferris/carcinization/lib/python/site-packages"),
|
||||
)
|
||||
.unwrap(),
|
||||
Path::new("foo/__init__.py")
|
||||
);
|
||||
assert_eq!(
|
||||
relative_to(
|
||||
Path::new("/home/ferris/carcinization/lib/marker.txt"),
|
||||
Path::new("/home/ferris/carcinization/lib/python/site-packages"),
|
||||
)
|
||||
.unwrap(),
|
||||
Path::new("../../marker.txt")
|
||||
);
|
||||
assert_eq!(
|
||||
relative_to(
|
||||
Path::new("/home/ferris/carcinization/bin/foo_launcher"),
|
||||
Path::new("/home/ferris/carcinization/lib/python/site-packages"),
|
||||
)
|
||||
.unwrap(),
|
||||
Path::new("../../../bin/foo_launcher")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_normalize_relative() {
|
||||
let cases = [
|
||||
(
|
||||
"../../workspace-git-path-dep-test/packages/c/../../packages/d",
|
||||
"../../workspace-git-path-dep-test/packages/d",
|
||||
),
|
||||
(
|
||||
"workspace-git-path-dep-test/packages/c/../../packages/d",
|
||||
"workspace-git-path-dep-test/packages/d",
|
||||
),
|
||||
("./a/../../b", "../b"),
|
||||
("/usr/../../foo", "/../foo"),
|
||||
];
|
||||
for (input, expected) in cases {
|
||||
assert_eq!(normalize_path(Path::new(input)), Path::new(expected));
|
||||
}
|
||||
}
|
||||
}
|
||||
mod tests;
|
||||
|
|
103
crates/uv-fs/src/path/tests.rs
Normal file
103
crates/uv-fs/src/path/tests.rs
Normal file
|
@ -0,0 +1,103 @@
|
|||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_normalize_url() {
|
||||
if cfg!(windows) {
|
||||
assert_eq!(
|
||||
normalize_url_path("/C:/Users/ferris/wheel-0.42.0.tar.gz"),
|
||||
"C:\\Users\\ferris\\wheel-0.42.0.tar.gz"
|
||||
);
|
||||
} else {
|
||||
assert_eq!(
|
||||
normalize_url_path("/C:/Users/ferris/wheel-0.42.0.tar.gz"),
|
||||
"/C:/Users/ferris/wheel-0.42.0.tar.gz"
|
||||
);
|
||||
}
|
||||
|
||||
if cfg!(windows) {
|
||||
assert_eq!(
|
||||
normalize_url_path("./ferris/wheel-0.42.0.tar.gz"),
|
||||
".\\ferris\\wheel-0.42.0.tar.gz"
|
||||
);
|
||||
} else {
|
||||
assert_eq!(
|
||||
normalize_url_path("./ferris/wheel-0.42.0.tar.gz"),
|
||||
"./ferris/wheel-0.42.0.tar.gz"
|
||||
);
|
||||
}
|
||||
|
||||
if cfg!(windows) {
|
||||
assert_eq!(
|
||||
normalize_url_path("./wheel%20cache/wheel-0.42.0.tar.gz"),
|
||||
".\\wheel cache\\wheel-0.42.0.tar.gz"
|
||||
);
|
||||
} else {
|
||||
assert_eq!(
|
||||
normalize_url_path("./wheel%20cache/wheel-0.42.0.tar.gz"),
|
||||
"./wheel cache/wheel-0.42.0.tar.gz"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_normalize_path() {
|
||||
let path = Path::new("/a/b/../c/./d");
|
||||
let normalized = normalize_absolute_path(path).unwrap();
|
||||
assert_eq!(normalized, Path::new("/a/c/d"));
|
||||
|
||||
let path = Path::new("/a/../c/./d");
|
||||
let normalized = normalize_absolute_path(path).unwrap();
|
||||
assert_eq!(normalized, Path::new("/c/d"));
|
||||
|
||||
// This should be an error.
|
||||
let path = Path::new("/a/../../c/./d");
|
||||
let err = normalize_absolute_path(path).unwrap_err();
|
||||
assert_eq!(err.kind(), std::io::ErrorKind::InvalidInput);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_relative_to() {
|
||||
assert_eq!(
|
||||
relative_to(
|
||||
Path::new("/home/ferris/carcinization/lib/python/site-packages/foo/__init__.py"),
|
||||
Path::new("/home/ferris/carcinization/lib/python/site-packages"),
|
||||
)
|
||||
.unwrap(),
|
||||
Path::new("foo/__init__.py")
|
||||
);
|
||||
assert_eq!(
|
||||
relative_to(
|
||||
Path::new("/home/ferris/carcinization/lib/marker.txt"),
|
||||
Path::new("/home/ferris/carcinization/lib/python/site-packages"),
|
||||
)
|
||||
.unwrap(),
|
||||
Path::new("../../marker.txt")
|
||||
);
|
||||
assert_eq!(
|
||||
relative_to(
|
||||
Path::new("/home/ferris/carcinization/bin/foo_launcher"),
|
||||
Path::new("/home/ferris/carcinization/lib/python/site-packages"),
|
||||
)
|
||||
.unwrap(),
|
||||
Path::new("../../../bin/foo_launcher")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_normalize_relative() {
|
||||
let cases = [
|
||||
(
|
||||
"../../workspace-git-path-dep-test/packages/c/../../packages/d",
|
||||
"../../workspace-git-path-dep-test/packages/d",
|
||||
),
|
||||
(
|
||||
"workspace-git-path-dep-test/packages/c/../../packages/d",
|
||||
"workspace-git-path-dep-test/packages/d",
|
||||
),
|
||||
("./a/../../b", "../b"),
|
||||
("/usr/../../foo", "/../foo"),
|
||||
];
|
||||
for (input, expected) in cases {
|
||||
assert_eq!(normalize_path(Path::new(input)), Path::new(expected));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue