Compare commits

...

3 Commits

Author SHA1 Message Date
Jean-Claude a6b254ca2d Disable signing of commits
This leads to problems as it requires the unlocked GPG key. It also
slows down the process.
2023-10-09 15:09:50 +02:00
Jean-Claude 255f1df055 Cleanup add missing & and remove unnecessary change of CWD 2023-10-09 15:08:43 +02:00
Jean-Claude 5f8ccf0ab0 Fix tempdir collisions between testing functions
testdir sees parametrized tests as caseN instead of testXY:caseN. This
leads to collisions between multiple testing functions.

An issue was filed: https://github.com/flub/testdir/issues/6
2023-10-09 15:03:25 +02:00
2 changed files with 17 additions and 5 deletions

View File

@ -10,7 +10,14 @@ use testdir::testdir;
#[fixture]
/// Return path to a temporary test directory
pub fn tmp_dir() -> PathBuf {
testdir!()
let mut path = testdir!();
path.push(format!(
"dir_{}",
Alphanumeric.sample_string(&mut thread_rng(), 8)
));
fs::create_dir_all(&path)
.unwrap_or_else(|_| panic!("Failed to create tmpdir {}", path.display()));
path
}
#[fixture]

View File

@ -155,21 +155,21 @@ mod tests {
.arg("branch")
.arg("branch1")
.arg("main")
.current_dir(repo)
.current_dir(&repo)
.output()
.expect("Failed to run command");
Command::new("git")
.arg("branch")
.arg("branch2")
.arg("main")
.current_dir(repo)
.current_dir(&repo)
.output()
.expect("Failed to run command");
Command::new("git")
.arg("branch")
.arg("branch3")
.arg("main")
.current_dir(repo)
.current_dir(&repo)
.output()
.expect("Failed to run command");
}
@ -179,7 +179,6 @@ mod tests {
///
/// Changes working directory into the repo's root.
fn repository(tmp_dir: PathBuf) -> (Repository, PathBuf) {
set_current_dir(&tmp_dir).expect("Failed to change dir");
let repo = Repository::init(&tmp_dir).unwrap();
let _ = Command::new("git")
@ -187,6 +186,8 @@ mod tests {
.arg("--allow-empty")
.arg("--message")
.arg("INITIAL COMMIT")
.arg("--no-signoff")
.arg("--no-gpg-sign")
.current_dir(&tmp_dir)
.output()
.expect("Failed to run command");
@ -324,6 +325,8 @@ mod tests {
.arg("commit")
.arg("--message")
.arg("Add FILE1")
.arg("--no-signoff")
.arg("--no-gpg-sign")
.current_dir(&repository.1)
.output()
.unwrap();
@ -347,6 +350,8 @@ mod tests {
.arg("commit")
.arg("--message")
.arg("Update FILE1")
.arg("--no-signoff")
.arg("--no-gpg-sign")
.current_dir(&repository.1)
.output()
.unwrap();