[python-debian/master] Use os.path.normpath to hide python version differences

James Westby jw+debian at jameswestby.net
Fri Jun 25 17:26:28 UTC 2010


python2.6 changed how the tarfile module outputs paths, which
broke the debfile tests. We use os.path.norpath to hide the difference
and get consistent behaviour across versions.
---
 debian/changelog      |    7 +++++++
 tests/test_debfile.py |    7 +++----
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index d551e5d..6c37786 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+python-debian (0.1.17) UNRELEASED; urgency=low
+
+  [ James Westby ]
+  * Use os.path.normpath to hide python version differences
+
+ -- John Wright <jsw at debian.org>  Fri, 25 Jun 2010 11:20:22 -0600
+
 python-debian (0.1.16) unstable; urgency=low
 
   * debian_support: Be more careful in case apt_pkg is not available
diff --git a/tests/test_debfile.py b/tests/test_debfile.py
index 2287521..1de4777 100755
--- a/tests/test_debfile.py
+++ b/tests/test_debfile.py
@@ -136,18 +136,17 @@ class TestDebFile(unittest.TestCase):
         bz2_deb = debfile.DebFile(self.bz2_debname)
         # random test on the data part (which is bzipped), just to check if we
         # can access its content
-        self.assertEqual(bz2_deb.data.tgz().getnames()[10],
+        self.assertEqual(os.path.normpath(bz2_deb.data.tgz().getnames()[10]),
                 './usr/share/locale/bg/')
 
     def test_data_names(self):
         """ test for file list equality """ 
-        strip_dot_slash = lambda s: re.sub(r'^\./', '', s)
         tgz = self.d.data.tgz()
-        dpkg_names = map(strip_dot_slash,
+        dpkg_names = map(os.path.normpath,
                 [ x.strip() for x in
                     os.popen("dpkg-deb --fsys-tarfile %s | tar t" %
                         self.debname).readlines() ])
-        debfile_names = map(strip_dot_slash, tgz.getnames())
+        debfile_names = map(os.path.normpath, tgz.getnames())
         
         # skip the root
         self.assertEqual(debfile_names[1:], dpkg_names[1:])
-- 
1.7.1




More information about the pkg-python-debian-commits mailing list