From 79e447fcc29d4591f1a4b3403840357e8bccb234 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" <jaraco@jaraco.com>
Date: Sat, 13 Jun 2015 11:05:37 -0400
Subject: [PATCH] Fix test failure when __PYVENV_LAUNCHER__ is set. Fixes #396.

---
 setuptools/tests/test_easy_install.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index e71bbfc9..a690315d 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -488,9 +488,11 @@ class TestCommandSpec:
         cmd_new = ei.CommandSpec.from_param(cmd)
         assert cmd is cmd_new
 
+    @mock.patch('sys.executable', TestScriptHeader.exe_with_spaces)
+    @mock.patch.dict(os.environ)
     def test_from_environment_with_spaces_in_executable(self):
-        with mock.patch('sys.executable', TestScriptHeader.exe_with_spaces):
-            cmd = ei.CommandSpec.from_environment()
+        del os.environ['__PYVENV_LAUNCHER__']
+        cmd = ei.CommandSpec.from_environment()
         assert len(cmd) == 1
         assert cmd.as_header().startswith('#!"')
 
-- 
2.30.9