← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/testfix-python-debian-parse-depends into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/testfix-python-debian-parse-depends into lp:launchpad.

Commit message:
Fix doctests: apt_pkg.parse_depends returned a structure containing str when given unicode, but PkgRelation.parse_relations returns a structure containing unicode in this case.

Requested reviews:
  Colin Watson (cjwatson)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/testfix-python-debian-parse-depends/+merge/266376

Fix doctests: apt_pkg.parse_depends returned a structure containing str when given unicode, but PkgRelation.parse_relations returns a structure containing unicode in this case.

I also made relationship_builder set operator and version to u'' rather than '' in the version=None case; it shouldn't matter at run-time, but makes doctests look cleaner.
-- 
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.
=== modified file 'lib/lp/soyuz/browser/packagerelationship.py'
--- lib/lp/soyuz/browser/packagerelationship.py	2015-07-29 16:55:28 +0000
+++ lib/lp/soyuz/browser/packagerelationship.py	2015-07-30 09:07:50 +0000
@@ -45,8 +45,8 @@
         else:
             url = None
         if rel['version'] is None:
-            operator = ''
-            version = ''
+            operator = u''
+            version = u''
         else:
             operator, version = rel['version']
         relationship_set.add(name, operator, version, url)

=== modified file 'lib/lp/soyuz/browser/tests/binarypackagerelease-views.txt'
--- lib/lp/soyuz/browser/tests/binarypackagerelease-views.txt	2012-12-26 01:32:19 +0000
+++ lib/lp/soyuz/browser/tests/binarypackagerelease-views.txt	2015-07-30 09:07:50 +0000
@@ -47,8 +47,8 @@
 
   >>> for dep in pmount_deps:
   ...    dep.name, dep.operator, dep.version, dep.url
-  ('at', '>=', '3.14156', u'http://launchpad.dev/ubuntu/hoary/i386/at')
-  ('linux-2.6.12', None, '', u'http://launchpad.dev/ubuntu/hoary/i386/linux-2.6.12')
-  ('tramp-package', None, '', None)
+  (u'at', u'>=', u'3.14156', u'http://launchpad.dev/ubuntu/hoary/i386/at')
+  (u'linux-2.6.12', None, u'', u'http://launchpad.dev/ubuntu/hoary/i386/linux-2.6.12')
+  (u'tramp-package', None, u'', None)
 
 Other relationship groups use the same mechanism.

=== modified file 'lib/lp/soyuz/browser/tests/sourcepackage-views.txt'
--- lib/lp/soyuz/browser/tests/sourcepackage-views.txt	2014-11-10 00:53:02 +0000
+++ lib/lp/soyuz/browser/tests/sourcepackage-views.txt	2015-07-30 09:07:50 +0000
@@ -74,12 +74,12 @@
 
   >>> for dep in firefox_parsed_depends:
   ...    dep.name, dep.operator, dep.version, dep.url
-  ('gcc-3.4', '>=', '3.4.1-4sarge1', None)
-  ('gcc-3.4', '<<', '3.4.2', None)
-  ('gcc-3.4-base', None, '', None)
-  ('libc6', '>=', '2.3.2.ds1-4', None)
-  ('libstdc++6-dev', '>=', '3.4.1-4sarge1', None)
-  ('pmount', None, '', u'http://launchpad.dev/ubuntu/warty/+package/pmount')
+  (u'gcc-3.4', u'>=', u'3.4.1-4sarge1', None)
+  (u'gcc-3.4', u'<<', u'3.4.2', None)
+  (u'gcc-3.4-base', None, u'', None)
+  (u'libc6', u'>=', u'2.3.2.ds1-4', None)
+  (u'libstdc++6-dev', u'>=', u'3.4.1-4sarge1', None)
+  (u'pmount', None, u'', u'http://launchpad.dev/ubuntu/warty/+package/pmount')
 
 
   >>> firefox_parsed_dependsindep = firefox_view.builddependsindep
@@ -89,10 +89,10 @@
 
   >>> for dep in firefox_parsed_dependsindep:
   ...    dep.name, dep.operator, dep.version, dep.url
-  ('bacula-common', '=', '1.34.6-2', None)
-  ('bacula-director-common', '=', '1.34.6-2', None)
-  ('pmount', None, '', u'http://launchpad.dev/ubuntu/warty/+package/pmount')
-  ('postgresql-client', '>=', '7.4', None)
+  (u'bacula-common', u'=', u'1.34.6-2', None)
+  (u'bacula-director-common', u'=', u'1.34.6-2', None)
+  (u'pmount', None, u'', u'http://launchpad.dev/ubuntu/warty/+package/pmount')
+  (u'postgresql-client', u'>=', u'7.4', None)
 
 Ensure we have fixed bug 31039, by properly escape the
 sourcepackagename before passing to regexp.


References