[Python-checkins] cpython: Actually check the contents of the file created by packaging’s bdist_dumb

eric.araujo python-checkins at python.org
Thu Nov 3 16:45:52 CET 2011


http://hg.python.org/cpython/rev/5420316921a0
changeset:   73325:5420316921a0
user:        Éric Araujo <merwok at netwok.org>
date:        Thu Nov 03 06:00:02 2011 +0100
summary:
  Actually check the contents of the file created by packaging’s bdist_dumb

files:
  Lib/packaging/tests/test_command_bdist_dumb.py |  17 +++++++--
  1 files changed, 13 insertions(+), 4 deletions(-)


diff --git a/Lib/packaging/tests/test_command_bdist_dumb.py b/Lib/packaging/tests/test_command_bdist_dumb.py
--- a/Lib/packaging/tests/test_command_bdist_dumb.py
+++ b/Lib/packaging/tests/test_command_bdist_dumb.py
@@ -1,6 +1,9 @@
 """Tests for distutils.command.bdist_dumb."""
 
 import os
+import imp
+import sys
+import zipfile
 import packaging.util
 
 from packaging.dist import Distribution
@@ -49,15 +52,21 @@
 
         # see what we have
         dist_created = os.listdir(os.path.join(pkg_dir, 'dist'))
-        base = "%s.%s" % (dist.get_fullname(), cmd.plat_name)
+        base = "%s.%s.zip" % (dist.get_fullname(), cmd.plat_name)
         if os.name == 'os2':
             base = base.replace(':', '-')
 
-        wanted = ['%s.zip' % base]
-        self.assertEqual(dist_created, wanted)
+        self.assertEqual(dist_created, [base])
 
         # now let's check what we have in the zip file
-        # XXX to be done
+        with zipfile.ZipFile(os.path.join('dist', base)) as fp:
+            contents = fp.namelist()
+
+        contents = sorted(os.path.basename(fn) for fn in contents)
+        wanted = ['foo.py',
+                  'foo.%s.pyc' % imp.get_tag(),
+                  'METADATA', 'INSTALLER', 'REQUESTED', 'RECORD']
+        self.assertEqual(contents, sorted(wanted))
 
     def test_finalize_options(self):
         pkg_dir, dist = self.create_dist()

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list