diff options
author | Philip Thiem <ptthiem@gmail.com> | 2013-11-11 17:07:52 -0600 |
---|---|---|
committer | Philip Thiem <ptthiem@gmail.com> | 2013-11-11 17:07:52 -0600 |
commit | 76423012b5b51691dd059b1276351099e52c787e (patch) | |
tree | 85d004d9b7f0c838a52597546869cc5185f5f4a0 /setuptools/tests/environment.py | |
parent | ba9d35158fe8f4af6a2b19e84a2eaca718a93e03 (diff) | |
download | external_python_setuptools-76423012b5b51691dd059b1276351099e52c787e.tar.gz external_python_setuptools-76423012b5b51691dd059b1276351099e52c787e.tar.bz2 external_python_setuptools-76423012b5b51691dd059b1276351099e52c787e.zip |
For .svn legacy fallback, look for the files in the .svn not the directory.
(Fixed unexpected deprecation warning from prombredanne)
Also removed the warning from fallback, only a deprecation warning is issued.
Environment.py whitespacing
Created a specialized command executor for tests in Environment.py
Legacy Test in test_egg_info now supresses the deprecation warning.
PythonPath is now explicitly controlled to allow setup.py test on clean
python installations. *Fixes Issue #101*
Moved some dummy svn tests from test_sdist to test_egg_info since
they are egg_info tests.
Downgraded a with statement in a test since we haven't offically dropped
2.4 support, however, maybe it is time.
Added a test case to ensure no extranuous output on sdist with a simple
dummy package without rev ctrl.
Diffstat (limited to 'setuptools/tests/environment.py')
-rw-r--r-- | setuptools/tests/environment.py | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/setuptools/tests/environment.py b/setuptools/tests/environment.py index 7c754b8e..b41e1549 100644 --- a/setuptools/tests/environment.py +++ b/setuptools/tests/environment.py @@ -5,6 +5,9 @@ import tempfile import unittest import shutil import stat +import unicodedata + +from subprocess import Popen as _Popen, PIPE as _PIPE def _extract(self, member, path=None, pwd=None): @@ -25,13 +28,14 @@ def _extract_from_zip(self, name, dest_path): finally: dest_file.close() + def _extract_member(self, member, targetpath, pwd): """for zipfile py2.5 borrowed from cpython""" # build the destination pathname, replacing # forward slashes to platform specific separators. # Strip trailing path separator, unless it represents the root. if (targetpath[-1:] in (os.path.sep, os.path.altsep) - and len(os.path.splitdrive(targetpath)[1]) > 1): + and len(os.path.splitdrive(targetpath)[1]) > 1): targetpath = targetpath[:-1] # don't include leading "/" from file name if present @@ -102,3 +106,47 @@ class ZippedEnvironment(unittest.TestCase): #sigh? pass + +def run_setup_py(cmd, pypath=None, path=None, + data_stream=0, env=None): + """ + Execution command for tests, separate from those used by the + code directly to prevent accidental behavior issues + """ + if env is None: + env = dict() + + #override the python path if needed + if pypath is None: + env["PYTHONPATH"] = os.environ.get("PYTHONPATH", "") + else: + env["PYTHONPATH"] = pypath + + #oeride the execution path if needed + if path is None: + env["PATH"] = os.environ.get("PATH", "") + else: + env["PATH"] = pypath + + #Apparently this might be needed in windows platforms + if "SYSTEMROOT" in os.environ: + env["SYSTEMROOT"] = os.environ["SYSTEMROOT"] + + cmd = [sys.executable, "setup.py"] + list(cmd) + + #regarding the shell argument, see: http://bugs.python.org/issue8557 + try: + proc = _Popen(cmd, stdout=_PIPE, stderr=_PIPE, + shell=(sys.platform == 'win32'), env=env) + + data = proc.communicate()[data_stream] + except OSError: + return 1, '' + + #decode the console string if needed + if hasattr(data, "decode"): + data = data.decode() # should use the preffered encoding + data = unicodedata.normalize('NFC', data) + + #communciate calls wait() + return proc.returncode, data |