Author: Armin Rigo <armin.r...@gmail.com> Branch: Changeset: r3135:f888d26538c0 Date: 2018-08-07 21:47 +0000 http://bitbucket.org/cffi/cffi/changeset/f888d26538c0/
Log: Merged in kelledin/cffi/create-tmp-homedir (pull request #89) point $HOME to empty tempdir rather than a nonexistent path diff --git a/testing/cffi1/test_zdist.py b/testing/cffi1/test_zdist.py --- a/testing/cffi1/test_zdist.py +++ b/testing/cffi1/test_zdist.py @@ -2,6 +2,8 @@ import subprocess import cffi from testing.udir import udir +from shutil import rmtree +from tempfile import mkdtemp def chdir_to_tmp(f): @@ -33,13 +35,20 @@ env = os.environ.copy() # a horrible hack to prevent distutils from finding ~/.pydistutils.cfg # (there is the --no-user-cfg option, but not in Python 2.6...) - env['HOME'] = '/this/path/does/not/exist' + # NOTE: pointing $HOME to a nonexistent directory can break certain things + # that look there for configuration (like ccache). + tmp_home = mkdtemp() + assert tmp_home != None, "cannot create temporary homedir" + env['HOME'] = tmp_home if cwd is None: newpath = self.rootdir if 'PYTHONPATH' in env: newpath += os.pathsep + env['PYTHONPATH'] env['PYTHONPATH'] = newpath - subprocess.check_call([self.executable] + args, cwd=cwd, env=env) + try: + subprocess.check_call([self.executable] + args, cwd=cwd, env=env) + finally: + rmtree(tmp_home) def _prepare_setuptools(self): if hasattr(TestDist, '_setuptools_ready'): _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit