From a0ba63874af48f21a95dd331d22e6fcfa587a03e Mon Sep 17 00:00:00 2001
From: Tommie Levy <thomas.a.levy@gmail.com>
Date: Wed, 18 Jul 2018 14:25:28 -0700
Subject: [PATCH] Run leaky tests in sequence

---
 src/lib/shell/variables/mod.rs | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/lib/shell/variables/mod.rs b/src/lib/shell/variables/mod.rs
index c1b7adf7..dcac0a6d 100644
--- a/src/lib/shell/variables/mod.rs
+++ b/src/lib/shell/variables/mod.rs
@@ -767,8 +767,15 @@ mod tests {
         assert_eq!("BAR", &expanded);
     }
 
+    use std::sync::Mutex;
+    lazy_static! {
+        static ref ENVLOCK: Mutex<()> = Mutex::new(());
+    }
+
     #[test]
     fn minimal_directory_var_should_compact_path() {
+        // Make sure we dont read the other tests writes to env
+        let _guard = ENVLOCK.lock().unwrap();
         let variables = Variables::default();
         env::set_var("PWD", "/var/log/nix");
         assert_eq!(
@@ -782,6 +789,8 @@ mod tests {
 
     #[test]
     fn minimal_directory_var_shouldnt_compact_path() {
+        // Make sure we dont read the other tests writes to env
+        let _guard = ENVLOCK.lock().unwrap();
         let variables = Variables::default();
         env::set_var("PWD", "/var/log");
         assert_eq!(
-- 
GitLab