diff -r 39fadb0255cd Lib/distutils/tests/support.py --- a/Lib/distutils/tests/support.py Mon Jun 27 18:25:06 2011 -0500 +++ b/Lib/distutils/tests/support.py Mon Jun 27 19:50:18 2011 -0700 @@ -7,6 +7,17 @@ from distutils import log from distutils.log import DEBUG, INFO, WARN, ERROR, FATAL from distutils.core import Distribution +from distutils.spawn import find_executable as _find_executable + +def find_executable(executable, path=None): + ''' + A wrapper around `distutils.spawn.find_executable` to make sure it returns + None when `os.environ['PATH']` is undefined. + ''' + if path or 'PATH' in os.environ: + return _find_executable(executable, path) + else: + return None class LoggingSilencer(object): diff -r 39fadb0255cd Lib/distutils/tests/test_archive_util.py --- a/Lib/distutils/tests/test_archive_util.py Mon Jun 27 18:25:06 2011 -0500 +++ b/Lib/distutils/tests/test_archive_util.py Mon Jun 27 19:50:18 2011 -0700 @@ -11,8 +11,9 @@ from distutils.archive_util import (check_archive_formats, make_tarball, make_zipfile, make_archive, ARCHIVE_FORMATS) -from distutils.spawn import find_executable, spawn +from distutils.spawn import spawn from distutils.tests import support +from distutils.tests.support import find_executable from test.support import check_warnings, run_unittest, patch try: diff -r 39fadb0255cd Lib/distutils/tests/test_bdist.py --- a/Lib/distutils/tests/test_bdist.py Mon Jun 27 18:25:06 2011 -0500 +++ b/Lib/distutils/tests/test_bdist.py Mon Jun 27 19:50:18 2011 -0700 @@ -9,7 +9,6 @@ from distutils.core import Distribution from distutils.command.bdist import bdist from distutils.tests import support -from distutils.spawn import find_executable from distutils import spawn from distutils.errors import DistutilsExecError diff -r 39fadb0255cd Lib/distutils/tests/test_bdist_rpm.py --- a/Lib/distutils/tests/test_bdist_rpm.py Mon Jun 27 18:25:06 2011 -0500 +++ b/Lib/distutils/tests/test_bdist_rpm.py Mon Jun 27 19:50:18 2011 -0700 @@ -10,7 +10,7 @@ from distutils.core import Distribution from distutils.command.bdist_rpm import bdist_rpm from distutils.tests import support -from distutils.spawn import find_executable +from distutils.tests.support import find_executable from distutils import spawn from distutils.errors import DistutilsExecError diff -r 39fadb0255cd Lib/distutils/tests/test_build_clib.py --- a/Lib/distutils/tests/test_build_clib.py Mon Jun 27 18:25:06 2011 -0500 +++ b/Lib/distutils/tests/test_build_clib.py Mon Jun 27 19:50:18 2011 -0700 @@ -8,7 +8,7 @@ from distutils.command.build_clib import build_clib from distutils.errors import DistutilsSetupError from distutils.tests import support -from distutils.spawn import find_executable +from distutils.tests.support import find_executable class BuildCLibTestCase(support.TempdirManager, support.LoggingSilencer, diff -r 39fadb0255cd Lib/distutils/tests/test_build_ext.py --- a/Lib/distutils/tests/test_build_ext.py Mon Jun 27 18:25:06 2011 -0500 +++ b/Lib/distutils/tests/test_build_ext.py Mon Jun 27 19:50:18 2011 -0700 @@ -64,6 +64,8 @@ name, equals, value = runshared.partition('=') cmd.library_dirs = value.split(os.pathsep) + @unittest.skipUnless('PATH' in os.environ, + 'PATH needs to be defined to find the compiler') def test_build_ext(self): global ALREADY_TESTED xx_c = os.path.join(self.tmp_dir, 'xxmodule.c') @@ -320,6 +322,8 @@ cmd.run() self.assertEqual(cmd.compiler, 'unix') + @unittest.skipUnless('PATH' in os.environ, + 'PATH needs to be defined to find the compiler') def test_get_outputs(self): tmp_dir = self.mkdtemp() c_file = os.path.join(tmp_dir, 'foo.c') diff -r 39fadb0255cd Lib/distutils/tests/test_sdist.py --- a/Lib/distutils/tests/test_sdist.py Mon Jun 27 18:25:06 2011 -0500 +++ b/Lib/distutils/tests/test_sdist.py Mon Jun 27 19:50:18 2011 -0700 @@ -14,7 +14,7 @@ from distutils.core import Distribution from distutils.tests.test_config import PyPIRCCommandTestCase from distutils.errors import DistutilsExecError, DistutilsOptionError -from distutils.spawn import find_executable +from distutils.tests.support import find_executable from distutils.tests import support from distutils.log import WARN from distutils.archive_util import ARCHIVE_FORMATS @@ -127,14 +127,12 @@ # making sure everything has been pruned correctly self.assertEqual(len(content), 4) - @unittest.skipUnless(ZLIB_SUPPORT, 'Need zlib support to run') + @unittest.skipUnless(ZLIB_SUPPORT and + find_executable('tar') and + find_executable('gzip'), + 'Need zlib, tar, & gzip support to run') def test_make_distribution(self): - # check if tar and gzip are installed - if (find_executable('tar') is None or - find_executable('gzip') is None): - return - # now building a sdist dist, cmd = self.get_cmd() diff -r 39fadb0255cd Lib/distutils/tests/test_spawn.py --- a/Lib/distutils/tests/test_spawn.py Mon Jun 27 18:25:06 2011 -0500 +++ b/Lib/distutils/tests/test_spawn.py Mon Jun 27 19:50:18 2011 -0700 @@ -5,7 +5,7 @@ from test.support import captured_stdout, run_unittest from distutils.spawn import _nt_quote_args -from distutils.spawn import spawn, find_executable +from distutils.spawn import spawn from distutils.errors import DistutilsExecError from distutils.tests import support