From 73c685a67debcfa26a940f37bbca69cb3a4af57e Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Tue, 22 Aug 2023 09:41:41 +0200 Subject: [PATCH] more cleanup of test crates --- Cargo.lock | 12 ++++-------- gix-config/tests/Cargo.toml | 17 +---------------- gix-config/tests/file/init/from_env.rs | 2 +- .../includes/conditional/gitdir/util.rs | 4 ++-- .../init/from_paths/includes/conditional/mod.rs | 2 +- .../from_paths/includes/conditional/onbranch.rs | 9 ++++++--- .../init/from_paths/includes/unconditional.rs | 2 +- gix-config/tests/file/init/from_paths/mod.rs | 6 +++--- gix-diff/tests/Cargo.toml | 8 ++------ gix-index/tests/Cargo.toml | 3 --- gix-pack/tests/Cargo.toml | 4 +--- gix-pack/tests/pack/bundle.rs | 2 +- .../tests/pack/data/output/count_and_entries.rs | 2 +- gix-pack/tests/pack/multi_index/write.rs | 2 +- gix-status/tests/Cargo.toml | 2 +- gix-traverse/tests/Cargo.toml | 3 +-- gix-worktree-state/tests/Cargo.toml | 2 +- gix-worktree/tests/Cargo.toml | 2 +- 18 files changed, 29 insertions(+), 55 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e3b4a43c495..a49e3429b61 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1427,16 +1427,13 @@ name = "gix-config-tests" version = "0.0.0" dependencies = [ "bstr", - "criterion", "gix", "gix-config", "gix-path 0.8.4", "gix-ref 0.34.0", "gix-sec 0.8.4", "gix-testtools", - "serde_derive", "serial_test", - "tempfile", ] [[package]] @@ -1946,7 +1943,7 @@ dependencies = [ [[package]] name = "gix-pack-tests" -version = "0.30.1" +version = "0.0.0" dependencies = [ "bstr", "gix-features 0.32.1", @@ -1958,7 +1955,6 @@ dependencies = [ "gix-traverse 0.31.0", "maplit", "memmap2 0.7.1", - "tempfile", ] [[package]] @@ -2244,7 +2240,7 @@ dependencies = [ [[package]] name = "gix-status-tests" -version = "0.1.0" +version = "0.0.0" dependencies = [ "bstr", "filetime", @@ -2523,7 +2519,7 @@ dependencies = [ [[package]] name = "gix-worktree-state-tests" -version = "0.1.0" +version = "0.0.0" dependencies = [ "gix-discover 0.23.0", "gix-features 0.32.1", @@ -2561,7 +2557,7 @@ dependencies = [ [[package]] name = "gix-worktree-tests" -version = "0.1.0" +version = "0.0.0" dependencies = [ "bstr", "gix-attributes 0.16.0", diff --git a/gix-config/tests/Cargo.toml b/gix-config/tests/Cargo.toml index 48aec5ac1c3..43488f1f72f 100644 --- a/gix-config/tests/Cargo.toml +++ b/gix-config/tests/Cargo.toml @@ -2,13 +2,10 @@ name = "gix-config-tests" version = "0.0.0" repository = "https://github.com/Byron/gitoxide" -description = "A git-config file parser and editor from the gitoxide project" +description = "Tests for the gix-config crate" license = "MIT OR Apache-2.0" authors = ["Edward Shen "] edition = "2021" -keywords = ["git-config", "git", "config", "gitoxide"] -categories = ["config", "parser-implementations"] -include = ["src/**/*", "LICENSE-*", "README.md", "CHANGELOG.md"] rust-version = "1.65" publish = false @@ -17,10 +14,6 @@ publish = false name = "config" path = "config.rs" -[features] -## Data structures implement `serde::Serialize` and `serde::Deserialize`. -serde = ["gix-config/serde"] - [dev-dependencies] gix-config = { path = ".."} gix-testtools = { path = "../../tests/tools"} @@ -29,12 +22,4 @@ gix-ref = { path = "../../gix-ref" } gix-path = { path = "../../gix-path" } gix-sec = { path = "../../gix-sec" } serial_test = { version = "2.0.0", default-features = false } -serde_derive = "1.0" -criterion = "0.5.1" -tempfile = "3.2.0" bstr = { version = "1.3.0", default-features = false, features = ["std"] } - -[package.metadata.docs.rs] -all-features = true -features = ["document-features"] -rustdoc-args = ["--cfg", "docsrs"] diff --git a/gix-config/tests/file/init/from_env.rs b/gix-config/tests/file/init/from_env.rs index e13f156eef7..4987c60603d 100644 --- a/gix-config/tests/file/init/from_env.rs +++ b/gix-config/tests/file/init/from_env.rs @@ -4,9 +4,9 @@ use gix_config::{ file::{includes, init, init::from_env}, File, }; +use gix_testtools::tempfile::tempdir; use gix_testtools::Env; use serial_test::serial; -use tempfile::tempdir; use crate::file::init::from_paths::escape_backslashes; diff --git a/gix-config/tests/file/init/from_paths/includes/conditional/gitdir/util.rs b/gix-config/tests/file/init/from_paths/includes/conditional/gitdir/util.rs index 88ee705e4e6..0469a4e2fd0 100644 --- a/gix-config/tests/file/init/from_paths/includes/conditional/gitdir/util.rs +++ b/gix-config/tests/file/init/from_paths/includes/conditional/gitdir/util.rs @@ -19,7 +19,7 @@ use crate::file::{ #[derive(Debug)] pub struct GitEnv { - tempdir: tempfile::TempDir, + tempdir: gix_testtools::tempfile::TempDir, root_dir: PathBuf, git_dir: PathBuf, home_dir: PathBuf, @@ -68,7 +68,7 @@ impl Condition { impl GitEnv { pub fn repo_name(repo_name: impl AsRef) -> crate::Result { - let tempdir = tempfile::tempdir()?; + let tempdir = gix_testtools::tempfile::tempdir()?; let root_dir = gix_path::realpath(tempdir.path())?; let worktree_dir = root_dir.join(repo_name); std::fs::create_dir_all(&worktree_dir)?; diff --git a/gix-config/tests/file/init/from_paths/includes/conditional/mod.rs b/gix-config/tests/file/init/from_paths/includes/conditional/mod.rs index 219ebf992cd..5803fedadef 100644 --- a/gix-config/tests/file/init/from_paths/includes/conditional/mod.rs +++ b/gix-config/tests/file/init/from_paths/includes/conditional/mod.rs @@ -4,7 +4,7 @@ use gix_config::{ file::{includes, init}, path, File, }; -use tempfile::tempdir; +use gix_testtools::tempfile::tempdir; use crate::file::{cow_str, init::from_paths::escape_backslashes}; diff --git a/gix-config/tests/file/init/from_paths/includes/conditional/onbranch.rs b/gix-config/tests/file/init/from_paths/includes/conditional/onbranch.rs index 3bedb59b5ec..988a787094a 100644 --- a/gix-config/tests/file/init/from_paths/includes/conditional/onbranch.rs +++ b/gix-config/tests/file/init/from_paths/includes/conditional/onbranch.rs @@ -13,7 +13,7 @@ use gix_ref::{ transaction::{Change, PreviousValue, RefEdit}, FullName, Target, }; -use tempfile::tempdir; +use gix_testtools::tempfile::tempdir; use crate::file::{cow_str, init::from_paths::includes::conditional::git_init}; @@ -181,7 +181,7 @@ enum Value { #[derive(Debug)] struct GitEnv { repo: gix::Repository, - dir: tempfile::TempDir, + dir: gix_testtools::tempfile::TempDir, } impl GitEnv { @@ -291,7 +291,10 @@ value = branch-override-by-include Ok(GitEnv { repo, dir }) } -fn assure_git_agrees(expected: Value, dir: tempfile::TempDir) -> crate::Result { +fn assure_git_agrees( + expected: Value, + dir: gix_testtools::tempfile::TempDir, +) -> crate::Result { let git_dir = dir.path(); let output = std::process::Command::new("git") .args(["config", "--get", "section.value"]) diff --git a/gix-config/tests/file/init/from_paths/includes/unconditional.rs b/gix-config/tests/file/init/from_paths/includes/unconditional.rs index 0e09533ef7f..ef24cdb80e2 100644 --- a/gix-config/tests/file/init/from_paths/includes/unconditional.rs +++ b/gix-config/tests/file/init/from_paths/includes/unconditional.rs @@ -4,7 +4,7 @@ use gix_config::{ file::{includes, init, init::from_paths}, File, }; -use tempfile::tempdir; +use gix_testtools::tempfile::tempdir; use crate::file::{ cow_str, diff --git a/gix-config/tests/file/init/from_paths/mod.rs b/gix-config/tests/file/init/from_paths/mod.rs index 30b5039b02e..53702a10c24 100644 --- a/gix-config/tests/file/init/from_paths/mod.rs +++ b/gix-config/tests/file/init/from_paths/mod.rs @@ -1,7 +1,7 @@ use std::{fs, path::PathBuf}; use gix_config::{File, Source}; -use tempfile::tempdir; +use gix_testtools::tempfile::tempdir; use crate::file::cow_str; @@ -13,7 +13,7 @@ pub(crate) fn escape_backslashes(path: impl AsRef) -> String { mod from_path_no_includes { #[test] fn file_not_found() { - let dir = tempfile::tempdir().unwrap(); + let dir = gix_testtools::tempfile::tempdir().unwrap(); let config_path = dir.path().join("config"); let err = gix_config::File::from_path_no_includes(config_path, gix_config::Source::Local).unwrap_err(); @@ -24,7 +24,7 @@ mod from_path_no_includes { #[test] fn single_path() { - let dir = tempfile::tempdir().unwrap(); + let dir = gix_testtools::tempfile::tempdir().unwrap(); let config_path = dir.path().join("config"); std::fs::write(config_path.as_path(), b"[core]\nboolean = true").unwrap(); diff --git a/gix-diff/tests/Cargo.toml b/gix-diff/tests/Cargo.toml index 728d4fd6aa8..6d07360ae38 100644 --- a/gix-diff/tests/Cargo.toml +++ b/gix-diff/tests/Cargo.toml @@ -4,18 +4,14 @@ version = "0.0.0" publish = false repository = "https://github.com/Byron/gitoxide" license = "MIT OR Apache-2.0" -description = "Please use `gix-` instead ('git' -> 'gix')" +description = "Tests for the gix-diff crate" authors = ["Sebastian Thiel "] edition = "2021" -include = ["src/**/*"] rust-version = "1.65" -[features] -serde = ["gix-diff/serde", "gix-hash/serde", "gix-object/serde"] - [[test]] -name = "diff" doctest = false +name = "diff" path = "diff.rs" [dev-dependencies] diff --git a/gix-index/tests/Cargo.toml b/gix-index/tests/Cargo.toml index d8586c4915b..4d74a4ad13e 100644 --- a/gix-index/tests/Cargo.toml +++ b/gix-index/tests/Cargo.toml @@ -13,12 +13,9 @@ rust-version = "1.65" name = "integrate" path = "integrate.rs" - [features] gix-features-parallel = ["gix-features/parallel"] -[dependencies] - [dev-dependencies] gix-index = { path = ".." } gix-features = { path = "../../gix-features", features = ["rustsha1", "progress"] } diff --git a/gix-pack/tests/Cargo.toml b/gix-pack/tests/Cargo.toml index afec172ddd4..eac694538dc 100644 --- a/gix-pack/tests/Cargo.toml +++ b/gix-pack/tests/Cargo.toml @@ -1,12 +1,11 @@ [package] name = "gix-pack-tests" -version = "0.30.1" +version = "0.0.0" repository = "https://github.com/Byron/gitoxide" authors = ["Sebastian Thiel "] license = "MIT OR Apache-2.0" description = "Please use `gix-` instead ('git' -> 'gix')" edition = "2018" -include = ["src/**/*", "CHANGELOG.md"] rust-version = "1.65" [features] @@ -22,7 +21,6 @@ gix-pack = { path = ".." } gix-features = { path = "../../gix-features" } gix-testtools = { path = "../../tests/tools"} gix-odb = { path = "../../gix-odb" } -tempfile = "3.1.0" bstr = { version = "1.3.0", default-features = false, features = ["std"] } maplit = "1.0.2" gix-object = { path = "../../gix-object" } diff --git a/gix-pack/tests/pack/bundle.rs b/gix-pack/tests/pack/bundle.rs index a44dd5b987c..33bb7431e92 100644 --- a/gix-pack/tests/pack/bundle.rs +++ b/gix-pack/tests/pack/bundle.rs @@ -80,7 +80,7 @@ mod write_to_directory { use gix_features::progress; use gix_odb::pack; - use tempfile::TempDir; + use gix_testtools::tempfile::TempDir; use crate::{ fixture_path, diff --git a/gix-pack/tests/pack/data/output/count_and_entries.rs b/gix-pack/tests/pack/data/output/count_and_entries.rs index 0c8ddbd6033..d5bd9bbd474 100644 --- a/gix-pack/tests/pack/data/output/count_and_entries.rs +++ b/gix-pack/tests/pack/data/output/count_and_entries.rs @@ -339,7 +339,7 @@ fn write_and_verify( _expected_pack_hash: gix_hash::ObjectId, _expected_thin_pack_hash: Option, ) -> crate::Result { - let tmp_dir = tempfile::TempDir::new()?; + let tmp_dir = gix_testtools::tempfile::TempDir::new()?; let pack_file_path = tmp_dir.path().join("new.pack"); let mut pack_file = std::fs::OpenOptions::new() .write(true) diff --git a/gix-pack/tests/pack/multi_index/write.rs b/gix-pack/tests/pack/multi_index/write.rs index cf9e339b15b..69a91a8b1a4 100644 --- a/gix-pack/tests/pack/multi_index/write.rs +++ b/gix-pack/tests/pack/multi_index/write.rs @@ -7,7 +7,7 @@ use crate::hex_to_id; #[test] fn from_paths() -> crate::Result { - let dir = tempfile::TempDir::new()?; + let dir = gix_testtools::tempfile::TempDir::new()?; let input_indices = std::fs::read_dir(fixture_path_standalone("objects/pack"))? .filter_map(|r| { r.ok() diff --git a/gix-status/tests/Cargo.toml b/gix-status/tests/Cargo.toml index 19985d8032b..d69aafd59b2 100644 --- a/gix-status/tests/Cargo.toml +++ b/gix-status/tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "gix-status-tests" -version = "0.1.0" +version = "0.0.0" repository = "https://github.com/Byron/gitoxide" license = "MIT OR Apache-2.0" description = "A crate to drive gix-status tests with different features" diff --git a/gix-traverse/tests/Cargo.toml b/gix-traverse/tests/Cargo.toml index b072ee524b4..053683f7be7 100644 --- a/gix-traverse/tests/Cargo.toml +++ b/gix-traverse/tests/Cargo.toml @@ -3,10 +3,9 @@ name = "gix-traverse-tests" version = "0.0.0" repository = "https://github.com/Byron/gitoxide" license = "MIT OR Apache-2.0" -description = "Please use `gix-` instead ('git' -> 'gix')" +description = "Integration tests for the gix-traverse crate" authors = ["Sebastian Thiel "] edition = "2021" -include = ["src/**/*"] rust-version = "1.65" [[test]] diff --git a/gix-worktree-state/tests/Cargo.toml b/gix-worktree-state/tests/Cargo.toml index 0de82e96a0e..9cabe4709dc 100644 --- a/gix-worktree-state/tests/Cargo.toml +++ b/gix-worktree-state/tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "gix-worktree-state-tests" -version = "0.1.0" +version = "0.0.0" repository = "https://github.com/Byron/gitoxide" license = "MIT OR Apache-2.0" description = "A crate for running tests with feature toggles on gix-worktree-state" diff --git a/gix-worktree/tests/Cargo.toml b/gix-worktree/tests/Cargo.toml index ceacb8f7116..f70dca8205a 100644 --- a/gix-worktree/tests/Cargo.toml +++ b/gix-worktree/tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "gix-worktree-tests" -version = "0.1.0" +version = "0.0.0" repository = "https://github.com/Byron/gitoxide" license = "MIT OR Apache-2.0" description = "A crate for testing the gix-worktree crate with feature toggles"