Commits

Tarek Ziadé  committed 2878280

make sure all tests passes on all python versions fixes #149

  • Participants
  • Parent commits cf793f5
  • Branches 0.6-maintenance

Comments (0)

Files changed (10)

 0.6.12
 ------
 
-*
+* Issue 149: Fixed various failures on 2.3/2.4
 
 ------
 0.6.11

File distribute.egg-info/entry_points.txt

 egg_info = setuptools.command.egg_info:egg_info
 register = setuptools.command.register:register
 upload_docs = setuptools.command.upload_docs:upload_docs
+upload = setuptools.command.upload:upload
 install_egg_info = setuptools.command.install_egg_info:install_egg_info
 alias = setuptools.command.alias:alias
 easy_install = setuptools.command.easy_install:easy_install
 
 [console_scripts]
 easy_install = setuptools.command.easy_install:main
-easy_install-2.6 = setuptools.command.easy_install:main
+easy_install-2.3 = setuptools.command.easy_install:main
 
 [setuptools.file_finders]
 svn_cvs = setuptools.command.sdist:_default_revctrl

File pkg_resources.py

             import plistlib
             plist = '/System/Library/CoreServices/SystemVersion.plist'
             if os.path.exists(plist):
-                plist_content = plistlib.readPlist(plist)
-                if 'ProductVersion' in plist_content:
-                    version = plist_content['ProductVersion']
+                if hasattr(plistlib, 'readPlist'):
+                    plist_content = plistlib.readPlist(plist)
+                    if 'ProductVersion' in plist_content:
+                        version = plist_content['ProductVersion']
 
         _cache.append(version.split('.'))
     return _cache[0]

File setuptools/command/install_scripts.py

         self.no_ep = False
 
     def run(self):
-        from setuptools.command.easy_install import (get_script_args,
-                                                     sys_executable)
+        from setuptools.command.easy_install import get_script_args
+        from setuptools.command.easy_install import sys_executable
 
         self.run_command("egg_info")
         if self.distribution.scripts:

File setuptools/command/test.py

                         submodule = module.__name__+'.'+file
                     else:
                         continue
-                tests.append(self.loadTestsFromName(submodule))
+                try:
+                    tests.append(self.loadTestsFromName(submodule))
+                except Exception, e:
+                    import pdb; pdb.set_trace()
+                    self.loadTestsFromName(submodule)
 
         if len(tests)!=1:
             return self.suiteClass(tests)

File setuptools/command/upload_docs.py

 
 from distutils import log
 from distutils.errors import DistutilsOptionError
-from distutils.command.upload import upload
+
+try:
+    from distutils.command.upload import upload
+except ImportError:
+    from setuptools.command.upload import upload
 
 _IS_PYTHON3 = sys.version > '3'
 

File setuptools/sandbox.py

         )
 
 
-_EXCEPTIONS = [os.devnull,]
+if hasattr(os, 'devnull'):
+    _EXCEPTIONS = [os.devnull,]
+else:
+    _EXCEPTIONS = []
 
-try:
-	gen_py = os.path.dirname(__import__('win32com.gen_py', fromlist=['__name__']).__file__)
-	_EXCEPTIONS.append(gen_py)
-except ImportError:
-	pass
+if not sys.version < '2.5':
+    try:
+        gen_py = os.path.dirname(__import__('win32com.gen_py',
+                                            fromlist=['__name__']).__file__)
+        _EXCEPTIONS.append(gen_py)
+    except ImportError:
+        pass
 
 class DirectorySandbox(AbstractSandbox):
     """Restrict operations to a single subdirectory - pseudo-chroot"""
 
     def _exempted(self, filepath):
         exception_matches = map(filepath.startswith, self._exceptions)
-        return any(exception_matches)
+        return False not in exception_matches
 
     def _remap_input(self,operation,path,*args,**kw):
         """Called for path inputs"""

File setuptools/tests/test_easy_install.py

 
 class TestPTHFileWriter(unittest.TestCase):
     def test_add_from_cwd_site_sets_dirty(self):
-        '''a pth file manager should set dirty 
+        '''a pth file manager should set dirty
         if a distribution is in site but also the cwd
         '''
         pth = PthDistributions('does-not_exist', [os.getcwd()])
-        self.assertFalse(pth.dirty)
+        self.assert_(not pth.dirty)
         pth.add(PRDistribution(os.getcwd()))
-        self.assertTrue(pth.dirty)
+        self.assert_(pth.dirty)
 
     def test_add_from_site_is_ignored(self):
         pth = PthDistributions('does-not_exist', ['/test/location/does-not-have-to-exist'])
-        self.assertFalse(pth.dirty)
+        self.assert_(not pth.dirty)
         pth.add(PRDistribution('/test/location/does-not-have-to-exist'))
-        self.assertFalse(pth.dirty)
+        self.assert_(not pth.dirty)
 
 
 class TestUserInstallTest(unittest.TestCase):

File setuptools/tests/test_sandbox.py

         shutil.rmtree(self.dir)
 
     def test_devnull(self):
+        if sys.version < '2.4':
+            return
         sandbox = DirectorySandbox(self.dir)
         sandbox.run(self._file_writer(os.devnull))
 
-    @staticmethod
     def _file_writer(path):
         def do_write():
             f = open(path, 'w')
             f.close()
         return do_write
 
+    _file_writer = staticmethod(_file_writer)
 
     if has_win32com():
         def test_win32com(self):
             target = os.path.join(gen_py, 'test_write')
             sandbox = DirectorySandbox(self.dir)
             try:
-                sandbox.run(self._file_writer(target))
-            except SandboxViolation:
-                self.fail("Could not create gen_py file due to SandboxViolation")
+                try:
+                    sandbox.run(self._file_writer(target))
+                except SandboxViolation:
+                    self.fail("Could not create gen_py file due to SandboxViolation")
             finally:
                 if os.path.exists(target): os.remove(target)
 

File setuptools/tests/test_upload_docs.py

         f.close()
         self.old_cwd = os.getcwd()
         os.chdir(self.dir)
-        
+
         self.upload_dir = os.path.join(self.dir, 'build')
         os.mkdir(self.upload_dir)
-        
+
         # A test document.
         f = open(os.path.join(self.upload_dir, 'index.html'), 'w')
         f.write("Hello world.")
         f.close()
-        
+
         # An empty folder.
         os.mkdir(os.path.join(self.upload_dir, 'empty'))
-        
+
         if sys.version >= "2.6":
             self.old_base = site.USER_BASE
             site.USER_BASE = upload_docs.USER_BASE = tempfile.mkdtemp()
             self.old_site = site.USER_SITE
             site.USER_SITE = upload_docs.USER_SITE = tempfile.mkdtemp()
-    
+
     def tearDown(self):
         os.chdir(self.old_cwd)
         shutil.rmtree(self.dir)
     def test_create_zipfile(self):
         # Test to make sure zipfile creation handles common cases.
         # This explicitly includes a folder containing an empty folder.
-        
+
         dist = Distribution()
-        
+
         cmd = upload_docs(dist)
         cmd.upload_dir = self.upload_dir
         zip_file = cmd.create_zipfile()
-        
+
         assert zipfile.is_zipfile(zip_file)
-        
+
         zip_f = zipfile.ZipFile(zip_file) # woh...
-        
+
         assert zip_f.namelist() == ['index.html']
-        
 
+