Skip to content

Commit

Permalink
more cleanup of test crates
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Aug 22, 2023
1 parent e0c64fd commit 73c685a
Show file tree
Hide file tree
Showing 18 changed files with 29 additions and 55 deletions.
12 changes: 4 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 1 addition & 16 deletions gix-config/tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>"]
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

Expand All @@ -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"}
Expand All @@ -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"]
2 changes: 1 addition & 1 deletion gix-config/tests/file/init/from_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -68,7 +68,7 @@ impl Condition {

impl GitEnv {
pub fn repo_name(repo_name: impl AsRef<Path>) -> crate::Result<Self> {
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)?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -181,7 +181,7 @@ enum Value {
#[derive(Debug)]
struct GitEnv {
repo: gix::Repository,
dir: tempfile::TempDir,
dir: gix_testtools::tempfile::TempDir,
}

impl GitEnv {
Expand Down Expand Up @@ -291,7 +291,10 @@ value = branch-override-by-include
Ok(GitEnv { repo, dir })
}

fn assure_git_agrees(expected: Value, dir: tempfile::TempDir) -> crate::Result<tempfile::TempDir> {
fn assure_git_agrees(
expected: Value,
dir: gix_testtools::tempfile::TempDir,
) -> crate::Result<gix_testtools::tempfile::TempDir> {
let git_dir = dir.path();
let output = std::process::Command::new("git")
.args(["config", "--get", "section.value"])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions gix-config/tests/file/init/from_paths/mod.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -13,7 +13,7 @@ pub(crate) fn escape_backslashes(path: impl AsRef<std::path::Path>) -> 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();
Expand All @@ -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();

Expand Down
8 changes: 2 additions & 6 deletions gix-diff/tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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-<thiscrate>` instead ('git' -> 'gix')"
description = "Tests for the gix-diff crate"
authors = ["Sebastian Thiel <[email protected]>"]
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]
Expand Down
3 changes: 0 additions & 3 deletions gix-index/tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
4 changes: 1 addition & 3 deletions gix-pack/tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
license = "MIT OR Apache-2.0"
description = "Please use `gix-<thiscrate>` instead ('git' -> 'gix')"
edition = "2018"
include = ["src/**/*", "CHANGELOG.md"]
rust-version = "1.65"

[features]
Expand All @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion gix-pack/tests/pack/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion gix-pack/tests/pack/data/output/count_and_entries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ fn write_and_verify(
_expected_pack_hash: gix_hash::ObjectId,
_expected_thin_pack_hash: Option<gix_hash::ObjectId>,
) -> 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)
Expand Down
2 changes: 1 addition & 1 deletion gix-pack/tests/pack/multi_index/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion gix-status/tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
3 changes: 1 addition & 2 deletions gix-traverse/tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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-<thiscrate>` instead ('git' -> 'gix')"
description = "Integration tests for the gix-traverse crate"
authors = ["Sebastian Thiel <[email protected]>"]
edition = "2021"
include = ["src/**/*"]
rust-version = "1.65"

[[test]]
Expand Down
2 changes: 1 addition & 1 deletion gix-worktree-state/tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion gix-worktree/tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit 73c685a

Please sign in to comment.