From 7855a1abec947dfb05fbb79393d972af02403bab Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=89ric=20Araujo?= Date: Thu, 3 Nov 2011 06:00:02 +0100 Subject: [PATCH] =?utf8?q?Actually=20check=20the=20contents=20of=20the=20f?= =?utf8?q?ile=20created=20by=20packaging=E2=80=99s=20bdist=5Fdumb?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Lib/packaging/tests/test_command_bdist_dumb.py | 17 +++++++++++++---- 1 file 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 index 8e2d497d79..15cf6586e4 100644 --- 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 @@ class BuildDumbTestCase(support.TempdirManager, # 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() -- 2.40.0