]> granicus.if.org Git - python/commitdiff
Issue #19492: Silently skipped distutils tests now reported as skipped.
authorSerhiy Storchaka <storchaka@gmail.com>
Wed, 18 Dec 2013 14:45:24 +0000 (16:45 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Wed, 18 Dec 2013 14:45:24 +0000 (16:45 +0200)
1  2 
Lib/distutils/tests/test_sdist.py
Lib/distutils/tests/test_sysconfig.py

index 164586b7846c3572f8e4efd1d4bacd8db48792f9,c9524061318f5a4a29b8bc80720c00654f709572..49e267e20aa1b0a720b6ac7979acf3e63e95aa60
@@@ -431,56 -423,6 +429,54 @@@ class SDistTestCase(PyPIRCCommandTestCa
          self.assertEqual(sorted(filenames), ['fake-1.0', 'fake-1.0/PKG-INFO',
                                               'fake-1.0/README.manual'])
  
-         # check if tar and gzip are installed
-         if (find_executable('tar') is None or
-                 find_executable('gzip') is None):
-             return
 +    @unittest.skipUnless(zlib, "requires zlib")
 +    @unittest.skipUnless(UID_GID_SUPPORT, "Requires grp and pwd support")
++    @unittest.skipIf(find_executable('tar') is None,
++                     "The tar command is not found")
++    @unittest.skipIf(find_executable('gzip') is None,
++                     "The gzip command is not found")
 +    def test_make_distribution_owner_group(self):
 +        # now building a sdist
 +        dist, cmd = self.get_cmd()
 +
 +        # creating a gztar and specifying the owner+group
 +        cmd.formats = ['gztar']
 +        cmd.owner = pwd.getpwuid(0)[0]
 +        cmd.group = grp.getgrgid(0)[0]
 +        cmd.ensure_finalized()
 +        cmd.run()
 +
 +        # making sure we have the good rights
 +        archive_name = join(self.tmp_dir, 'dist', 'fake-1.0.tar.gz')
 +        archive = tarfile.open(archive_name)
 +        try:
 +            for member in archive.getmembers():
 +                self.assertEqual(member.uid, 0)
 +                self.assertEqual(member.gid, 0)
 +        finally:
 +            archive.close()
 +
 +        # building a sdist again
 +        dist, cmd = self.get_cmd()
 +
 +        # creating a gztar
 +        cmd.formats = ['gztar']
 +        cmd.ensure_finalized()
 +        cmd.run()
 +
 +        # making sure we have the good rights
 +        archive_name = join(self.tmp_dir, 'dist', 'fake-1.0.tar.gz')
 +        archive = tarfile.open(archive_name)
 +
 +        # note that we are not testing the group ownership here
 +        # because, depending on the platforms and the container
 +        # rights (see #7408)
 +        try:
 +            for member in archive.getmembers():
 +                self.assertEqual(member.uid, os.getuid())
 +        finally:
 +            archive.close()
 +
  def test_suite():
      return unittest.makeSuite(SDistTestCase)
  
index b5fdc98dc97f9c918a3c067d1b059e284d27f244,a1cb47d87cd7176990b939aca0ec3b46f2a522a0..95fa9dc111220dcedad2ef40c9669f5bf4a10847
@@@ -151,31 -147,10 +148,31 @@@ class SysconfigTestCase(support.Environ
  
          import sysconfig as global_sysconfig
          if sysconfig.get_config_var('CUSTOMIZED_OSX_COMPILER'):
-             return
+             self.skipTest('compiler flags customized')
 -        self.assertEqual(global_sysconfig.get_config_var('LDSHARED'), sysconfig.get_config_var('LDSHARED'))
 -        self.assertEqual(global_sysconfig.get_config_var('CC'), sysconfig.get_config_var('CC'))
 -
 +        self.assertEqual(global_sysconfig.get_config_var('LDSHARED'),
 +                         sysconfig.get_config_var('LDSHARED'))
 +        self.assertEqual(global_sysconfig.get_config_var('CC'),
 +                         sysconfig.get_config_var('CC'))
 +
 +    @unittest.skipIf(sysconfig.get_config_var('EXT_SUFFIX') is None,
 +                     'EXT_SUFFIX required for this test')
 +    def test_SO_deprecation(self):
 +        self.assertWarns(DeprecationWarning,
 +                         sysconfig.get_config_var, 'SO')
 +
 +    @unittest.skipIf(sysconfig.get_config_var('EXT_SUFFIX') is None,
 +                     'EXT_SUFFIX required for this test')
 +    def test_SO_value(self):
 +        with check_warnings(('', DeprecationWarning)):
 +            self.assertEqual(sysconfig.get_config_var('SO'),
 +                             sysconfig.get_config_var('EXT_SUFFIX'))
 +
 +    @unittest.skipIf(sysconfig.get_config_var('EXT_SUFFIX') is None,
 +                     'EXT_SUFFIX required for this test')
 +    def test_SO_in_vars(self):
 +        vars = sysconfig.get_config_vars()
 +        self.assertIsNotNone(vars['SO'])
 +        self.assertEqual(vars['SO'], vars['EXT_SUFFIX'])
  
  
  def test_suite():