Skip to content

Commit

Permalink
lock mutex
Browse files Browse the repository at this point in the history
  • Loading branch information
marcospb19 committed Dec 15, 2024
1 parent e152c73 commit 8f7c26f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::{
fmt::Debug,
fs,
path::{Path, PathBuf},
sync::Mutex,
};

use anyhow::{Context, Result};
Expand All @@ -16,6 +17,8 @@ use regex::Regex;
use tempfile::{tempdir, TempDir};
use unindent::unindent;

static MUTEX: Mutex<()> = Mutex::new(());

struct AnyhowWithContext(anyhow::Error);

impl Debug for AnyhowWithContext {
Expand Down Expand Up @@ -199,6 +202,8 @@ fn all_flags() -> TestResult {

#[test]
fn stamp_file() -> TestResult {
let _handle = MUTEX.lock();

let (size, target) = build("sample-project")?;
let stamp_file_exists = || {
project_dir("sample-project")
Expand Down Expand Up @@ -326,6 +331,8 @@ fn error_status() -> TestResult {
/// This scenario used to panic: https://github.com/holmgr/cargo-sweep/issues/117
#[test]
fn stamp_file_not_found() -> TestResult {
let _handle = MUTEX.lock();

sweep(&["--file"])
.current_dir(test_dir().join("sample-project"))
.assert()
Expand Down

0 comments on commit 8f7c26f

Please sign in to comment.