Commits

Chris Jerdonek  committed 06768b7

DRY up logic that creates the environment to use.

  • Participants
  • Parent commits f7f70c5

Comments (0)

Files changed (1)

File tox/_venv.py

             self.run_install_command(args, ixserver.url, action,
                                      extraenv=extraenv)
 
-    def _getenv(self):
-        env = self.envconfig.setenv
-        if env:
-            env_arg = os.environ.copy()
-            env_arg.update(env)
-        else:
-            env_arg = None
-        return env_arg
+    def _getenv(self, extraenv={}):
+        env = os.environ.copy()
+        setenv = self.envconfig.setenv
+        if setenv:
+            env.update(setenv)
+        env.update(extraenv)
+        return env
 
     def test(self, redirect=False):
         action = self.session.newaction(self, "runtests")
         old = self.patchPATH()
         try:
             args[0] = self.getcommandpath(args[0], venv, cwd)
-            env = self._getenv() or os.environ.copy()
-            env.update(extraenv)
+            env = self._getenv(extraenv)
             return action.popen(args, cwd=cwd, env=env, redirect=redirect)
         finally:
             os.environ['PATH'] = old