summaryrefslogtreecommitdiff
path: root/Lib/distutils/tests/test_bdist_rpm.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/distutils/tests/test_bdist_rpm.py')
-rw-r--r--Lib/distutils/tests/test_bdist_rpm.py49
1 files changed, 24 insertions, 25 deletions
diff --git a/Lib/distutils/tests/test_bdist_rpm.py b/Lib/distutils/tests/test_bdist_rpm.py
index ab7a1bf24e..bcbb5633e8 100644
--- a/Lib/distutils/tests/test_bdist_rpm.py
+++ b/Lib/distutils/tests/test_bdist_rpm.py
@@ -28,6 +28,11 @@ class BuildRpmTestCase(support.TempdirManager,
unittest.TestCase):
def setUp(self):
+ try:
+ sys.executable.encode("UTF-8")
+ except UnicodeEncodeError:
+ raise unittest.SkipTest("sys.executable is not encodable to UTF-8")
+
super(BuildRpmTestCase, self).setUp()
self.old_location = os.getcwd()
self.old_sys_argv = sys.argv, sys.argv[:]
@@ -38,18 +43,15 @@ class BuildRpmTestCase(support.TempdirManager,
sys.argv[:] = self.old_sys_argv[1]
super(BuildRpmTestCase, self).tearDown()
+ # XXX I am unable yet to make this test work without
+ # spurious sdtout/stderr output under Mac OS X
+ @unittest.skipUnless(sys.platform.startswith('linux'),
+ 'spurious sdtout/stderr output under Mac OS X')
+ @unittest.skipIf(find_executable('rpm') is None,
+ 'the rpm command is not found')
+ @unittest.skipIf(find_executable('rpmbuild') is None,
+ 'the rpmbuild command is not found')
def test_quiet(self):
-
- # XXX I am unable yet to make this test work without
- # spurious sdtout/stderr output under Mac OS X
- if sys.platform != 'linux2':
- return
-
- # this test will run only if the rpm commands are found
- if (find_executable('rpm') is None or
- find_executable('rpmbuild') is None):
- return
-
# let's create a package
tmp_dir = self.mkdtemp()
pkg_dir = os.path.join(tmp_dir, 'foo')
@@ -76,25 +78,22 @@ class BuildRpmTestCase(support.TempdirManager,
cmd.run()
dist_created = os.listdir(os.path.join(pkg_dir, 'dist'))
- self.assertTrue('foo-0.1-1.noarch.rpm' in dist_created)
+ self.assertIn('foo-0.1-1.noarch.rpm', dist_created)
# bug #2945: upload ignores bdist_rpm files
self.assertIn(('bdist_rpm', 'any', 'dist/foo-0.1-1.src.rpm'), dist.dist_files)
self.assertIn(('bdist_rpm', 'any', 'dist/foo-0.1-1.noarch.rpm'), dist.dist_files)
+ # XXX I am unable yet to make this test work without
+ # spurious sdtout/stderr output under Mac OS X
+ @unittest.skipUnless(sys.platform.startswith('linux'),
+ 'spurious sdtout/stderr output under Mac OS X')
+ # http://bugs.python.org/issue1533164
+ @unittest.skipIf(find_executable('rpm') is None,
+ 'the rpm command is not found')
+ @unittest.skipIf(find_executable('rpmbuild') is None,
+ 'the rpmbuild command is not found')
def test_no_optimize_flag(self):
-
- # XXX I am unable yet to make this test work without
- # spurious sdtout/stderr output under Mac OS X
- if sys.platform != 'linux2':
- return
-
- # http://bugs.python.org/issue1533164
- # this test will run only if the rpm command is found
- if (find_executable('rpm') is None or
- find_executable('rpmbuild') is None):
- return
-
# let's create a package that brakes bdist_rpm
tmp_dir = self.mkdtemp()
pkg_dir = os.path.join(tmp_dir, 'foo')
@@ -120,7 +119,7 @@ class BuildRpmTestCase(support.TempdirManager,
cmd.run()
dist_created = os.listdir(os.path.join(pkg_dir, 'dist'))
- self.assertTrue('foo-0.1-1.noarch.rpm' in dist_created)
+ self.assertIn('foo-0.1-1.noarch.rpm', dist_created)
# bug #2945: upload ignores bdist_rpm files
self.assertIn(('bdist_rpm', 'any', 'dist/foo-0.1-1.src.rpm'), dist.dist_files)