Skip clean-up of test temporary directories in CI

This commit is contained in:
Zanie Blue 2025-01-23 16:43:58 -06:00
parent 2803e6fc5f
commit 9d9dd0f22f

View file

@ -102,7 +102,7 @@ pub struct TestContext {
extra_env: Vec<(OsString, OsString)>,
#[allow(dead_code)]
_root: tempfile::TempDir,
_root: Option<tempfile::TempDir>,
}
impl TestContext {
@ -594,8 +594,18 @@ impl TestContext {
"https://raw.githubusercontent.com/astral-sh/packse/PACKSE_VERSION/".to_string(),
));
// When running in CI, we leave the temporary directories around because they can be
// expensive to delete and the machine is disposable.
let root_path = ChildPath::new(root.path());
let root = if env::var_os(EnvVars::CI).is_some() {
let _ = root.into_path();
None
} else {
Some(root)
};
Self {
root: ChildPath::new(root.path()),
root: root_path,
temp_dir,
cache_dir,
python_dir,