| # HG changeset patch |
| # User Armin Rigo <arigo@tunes.org> |
| # Date 1433182838 -7200 |
| # Node ID 34d5fd98bc84d202dd6692906f21509bb5abefaf |
| # Parent feea0af4a450e0ff0045f1b7c0a5f430c97520f9 |
| Issue #204: second try |
| |
| 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 |
| @@ -29,13 +29,17 @@ |
| if hasattr(self, 'saved_cwd'): |
| os.chdir(self.saved_cwd) |
| |
| - def run(self, args): |
| + def run(self, args, cwd=None): |
| env = os.environ.copy() |
| - newpath = self.rootdir |
| - if 'PYTHONPATH' in env: |
| - newpath += os.pathsep + env['PYTHONPATH'] |
| - env['PYTHONPATH'] = newpath |
| - subprocess.check_call([self.executable] + args, env=env) |
| + # 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' |
| + 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) |
| |
| def _prepare_setuptools(self): |
| if hasattr(TestDist, '_setuptools_ready'): |
| @@ -44,8 +48,7 @@ |
| import setuptools |
| except ImportError: |
| py.test.skip("setuptools not found") |
| - subprocess.check_call([self.executable, 'setup.py', 'egg_info'], |
| - cwd=self.rootdir) |
| + self.run(['setup.py', 'egg_info'], cwd=self.rootdir) |
| TestDist._setuptools_ready = True |
| |
| def check_produced_files(self, content, curdir=None): |