[python-debian/master] add tests for inter-package relationship support

Stefano Zacchiroli zack at upsilon.cc
Thu Jun 19 16:17:33 UTC 2008


---
 TODO                 |    2 -
 debian/changelog     |    1 +
 tests/test_Packages  |   62 +++++++++++++++++++++++++++++++++++
 tests/test_Sources   |   45 ++++++++++++++++++++++++++
 tests/test_deb822.py |   87 ++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 195 insertions(+), 2 deletions(-)
 create mode 100644 tests/test_Packages
 create mode 100644 tests/test_Sources

diff --git a/TODO b/TODO
index 6633759..3924a54 100644
--- a/TODO
+++ b/TODO
@@ -1,5 +1,3 @@
 - Revamp the README files. In particular, note that debian_support.py
   comes from the secure-testing repository (also in copyright!!), and
   that for reading Packages files Deb822 should be used instead.
-- parsed dependencies support:
-  - add tests
diff --git a/debian/changelog b/debian/changelog
index 0045bee..c6b6c01 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -16,6 +16,7 @@ python-debian (0.1.11) UNRELEASED; urgency=low
   * debian_bundle/deb822.py: add support for "parsed" dependencies and other
     inter-package relationships. See examples/deb822/depgraph for sample usage
   * examples/deb822/ add new example "depgraph"
+  * tests/test_deb822.py: add tests for inter-package relationships
 
  -- John Wright <jsw at debian.org>  Thu, 12 Jun 2008 12:16:53 +0100
 
diff --git a/tests/test_Packages b/tests/test_Packages
new file mode 100644
index 0000000..384e90e
--- /dev/null
+++ b/tests/test_Packages
@@ -0,0 +1,62 @@
+Package: a2ps
+Priority: optional
+Section: text
+Installed-Size: 4244
+Maintainer: Masayuki Hatta (mhatta) <mhatta at debian.org>
+Architecture: i386
+Version: 1:4.14-1
+Depends: file, libc6 (>= 2.7-1), libpaper1, psutils
+Recommends: bzip2, lpr | rlpr | cupsys-client, wdiff
+Suggests: emacsen-common, ghostscript, graphicsmagick-imagemagick-compat | imagemagick, groff, gv, html2ps, t1-cyrillic, texlive-base-bin
+Filename: pool/main/a/a2ps/a2ps_4.14-1_i386.deb
+Size: 926602
+MD5sum: ada9c133500447bc22f32419298e2d38
+SHA1: 757d7b81efb518d16dc7792a9c48ed63d338eefe
+SHA256: 2841c4c5bb68c1571615d1d32778b69bd03e95abd65b717a5fcd6f112a6b78fa
+Description: GNU a2ps - 'Anything to PostScript' converter and pretty-printer
+ GNU a2ps converts files into PostScript for printing or viewing. It uses a
+ nice default format, usually two pages on each physical page, borders
+ surrounding pages, headers with useful information (page number, printing
+ date, file name or supplied header), line numbering, symbol substitution
+ as well as pretty printing for a wide range of programming languages.
+ .
+ Historically, a2ps started as a text to PostScript converter, but thanks
+ to powerful delegations it is able to let you use it for any kind of files,
+ ie it can also digest manual pages, dvi files, texinfo, ....
+ .
+ Among the other most noticeable features of a2ps are:
+  - various encodings (all the Latins and others),
+  - various fonts (automatic font down loading),
+  - various medias,
+  - various printer interfaces,
+  - various output styles,
+  - various programming languages,
+  - various helping applications,
+  - and various spoken languages.
+Tag: devel::prettyprint, interface::commandline, role::program, scope::utility, suite::gnu, use::converting, use::printing, works-with::text, works-with-format::postscript
+
+Package: zssh
+Priority: optional
+Section: net
+Installed-Size: 88
+Maintainer: Ben Wong <ben at wongs.net>
+Architecture: i386
+Version: 1.5c.debian.1-3
+Depends: lrzsz, openssh-client | telnet | telnet-ssl, libc6 (>= 2.6.1-1), libncurses5 (>= 5.6), libreadline5 (>= 5.2)
+Filename: pool/main/z/zssh/zssh_1.5c.debian.1-3_i386.deb
+Size: 21864
+MD5sum: 21e4ac1bbdd405873aa969918e78b95c
+SHA1: 22b132fef92822e0bc8b612bbaf06165aa459bfc
+SHA256: 9d0d77df0312ef6487e0b06eb125446e130bd9de80df70ac0180abf7d4e4a0c5
+Description: interactive file transfers over ssh
+ zssh (Zmodem SSH) is a program for interactively transferring files to a
+ remote machine  while using  the secure  shell (ssh).  It is intended to
+ be a convenient  alternative to scp, allowing to  transfer files without
+ having to open another session and re-authenticate oneself.
+ .
+ Files are transferred through the zmodem  protocol,  using the rz and sz
+ commands.
+ .
+  Homepage: http://zssh.sourceforge.net/
+Tag: hardware::modem, interface::commandline, protocol::ssh, role::program, scope::utility, uitoolkit::ncurses, use::downloading
+
diff --git a/tests/test_Sources b/tests/test_Sources
new file mode 100644
index 0000000..0f3c67d
--- /dev/null
+++ b/tests/test_Sources
@@ -0,0 +1,45 @@
+Package: apache2-mpm-itk
+Binary: apache2-mpm-itk
+Version: 2.2.6-01-3
+Priority: extra
+Section: net
+Maintainer: Steinar H. Gunderson <sesse at debian.org>
+Build-Depends: apache2-src (>= 2.2.9), libaprutil1-dev, libcap-dev [!kfreebsd-i386 !kfreebsd-amd64 !hurd-i386], autoconf, debhelper (>> 5.0.0)
+Architecture: any
+Standards-Version: 3.7.3
+Format: 1.0
+Directory: pool/main/a/apache2-mpm-itk
+Files:
+ 24d02f8ecf0f37164cfcc2fb23bf1013 1135 apache2-mpm-itk_2.2.6-01-3.dsc
+ f8041c58e43dae9814f903919d222c73 33269 apache2-mpm-itk_2.2.6-01.orig.tar.gz
+ 71dcfe1d2349b376c062c964a87cd213 12824 apache2-mpm-itk_2.2.6-01-3.diff.gz
+Checksums-Sha1: 
+ c9ab75c5b2360d1f1ebee513cbf62963023196b9 33269 apache2-mpm-itk_2.2.6-01.orig.tar.gz
+ 12b996db5c4a628388c1402e13bd30aa0db3cec4 12824 apache2-mpm-itk_2.2.6-01-3.diff.gz
+Checksums-Sha256: 
+ e789b7754072fa6a629c55b931411806432102be7a379f750ac6d328df7790c3 33269 apache2-mpm-itk_2.2.6-01.orig.tar.gz
+ db631e44c83f7086b15e701bafcc7e6e1481f957d47b8075092ba80d863f83bb 12824 apache2-mpm-itk_2.2.6-01-3.diff.gz
+
+Package: binutils
+Binary: binutils, binutils-dev, binutils-multiarch, binutils-hppa64, binutils-spu, binutils-doc, binutils-source
+Version: 2.18.1~cvs20080103-6
+Priority: optional
+Section: devel
+Maintainer: James Troup <james at nocrew.org>
+Build-Depends: dpkg-dev (>= 1.13.9), autoconf (>= 2.13), bash, bison, flex, gettext, texinfo, expect-tcl8.3 (>= 5.32.2) [hppa], dejagnu (>= 1.4.2-1.1), dpatch, file, bzip2, lsb-release
+Architecture: any
+Standards-Version: 3.7.3
+Format: 1.0
+Directory: pool/main/b/binutils
+Files:
+ 04c6dfcfa9d7e2057fea9561610b009a 1331 binutils_2.18.1~cvs20080103-6.dsc
+ 23b4c0bdda7c9974489bc9d3aaf7a754 19746003 binutils_2.18.1~cvs20080103.orig.tar.gz
+ b57f7ed234c299f56a6545c4251e509e 64334 binutils_2.18.1~cvs20080103-6.diff.gz
+Uploaders: Matthias Klose <doko at debian.org>
+Checksums-Sha1: 
+ ec4182b10960eb6ce927af37326feaa114a232cc 19746003 binutils_2.18.1~cvs20080103.orig.tar.gz
+ 5589356c2c4cc9a94aeb9ba658c08a4ec3fae11b 64334 binutils_2.18.1~cvs20080103-6.diff.gz
+Checksums-Sha256: 
+ bf2e12578caf3b79be6182bb109b3a0215d8a3b89ae2049773f56f286eeb8ad3 19746003 binutils_2.18.1~cvs20080103.orig.tar.gz
+ 44e346757ce336f6a16879264b6cc4ff4e2b4da517e4b5db6cc7f1d254f302dd 64334 binutils_2.18.1~cvs20080103-6.diff.gz
+
diff --git a/tests/test_deb822.py b/tests/test_deb822.py
index 302ca61..07b49a1 100755
--- a/tests/test_deb822.py
+++ b/tests/test_deb822.py
@@ -484,5 +484,92 @@ Description: python modules to work with Debian-related data formats
             d3['Some-Test-Key'] = 'some value'
         self.assertEqual(d3.dump(), "Some-Test-Key: some value\n")
 
+
+class TestPkgRelations(unittest.TestCase):
+
+    def test_packages(self):
+        pkgs = deb822.Packages.iter_paragraphs(file('test_Packages'))
+        pkg1 = pkgs.next()
+        rel1 = {'breaks': [],
+                'conflicts': [],
+                'depends': [[{'name': 'file', 'version': None}],
+                    [{'name': 'libc6', 'version': None}],
+                    [{'name': 'libpaper1', 'version': None}],
+                    [{'name': 'psutils', 'version': None}]],
+                'enhances': [],
+                'pre-depends': [],
+                'provides': [],
+                'recommends': [[{'name': 'bzip2', 'version': None}],
+                    [{'name': 'lpr', 'version': None},
+                        {'name': 'rlpr', 'version': None},
+                        {'name': 'cupsys-client', 'version': None}],
+                    [{'name': 'wdiff', 'version': None}]],
+                'replaces': [],
+                'suggests': [[{'name': 'emacsen-common', 'version': None}],
+                    [{'name': 'ghostscript', 'version': None}],
+                    [{'name': 'graphicsmagick-imagemagick-compat',
+                        'version': None},
+                        {'name': 'imagemagick', 'version': None}],
+                    [{'name': 'groff', 'version': None}],
+                    [{'name': 'gv', 'version': None}],
+                    [{'name': 'html2ps', 'version': None}],
+                    [{'name': 't1-cyrillic', 'version': None}],
+                    [{'name': 'texlive-base-bin', 'version': None}]]}
+        self.assertEqual(rel1, pkg1.relations)
+        pkg2 = pkgs.next()
+        rel2 = {'breaks': [],
+                'conflicts': [],
+                'depends': [[{'name': 'lrzsz', 'version': None}],
+                    [{'name': 'openssh-client', 'version': None},
+                        {'name': 'telnet', 'version': None},
+                        {'name': 'telnet-ssl', 'version': None}],
+                    [{'name': 'libc6', 'version': None}],
+                    [{'name': 'libncurses5', 'version': None}],
+                    [{'name': 'libreadline5', 'version': None}]],
+                'enhances': [],
+                'pre-depends': [],
+                'provides': [],
+                'recommends': [],
+                'replaces': [],
+                'suggests': []}
+        self.assertEqual(rel2, pkg2.relations)
+
+    def test_sources(self):
+        pkgs = deb822.Sources.iter_paragraphs(file('test_Sources'))
+        pkg1 = pkgs.next()
+        rel1 = {'build-conflicts': [],
+                'build-conflicts-indep': [],
+                'build-depends': [[{'name': 'apache2-src', 'version': None}],
+                    [{'name': 'libaprutil1-dev', 'version': None}],
+                    [{'arch': [(False, 'kfreebsd-i386'),
+                        (False, 'kfreebsd-amd64'),
+                        (False, 'hurd-i386')],
+                        'name': 'libcap-dev',
+                        'version': None}],
+                    [{'name': 'autoconf', 'version': None}],
+                    [{'name': 'debhelper', 'version': None}]],
+                'build-depends-indep': []}
+        self.assertEqual(rel1, pkg1.relations)
+        pkg2 = pkgs.next()
+        rel2 = {'build-conflicts': [],
+                'build-conflicts-indep': [],
+                'build-depends': [[{'name': 'dpkg-dev', 'version': None}],
+                    [{'name': 'autoconf', 'version': None}],
+                    [{'name': 'bash', 'version': None}],
+                    [{'name': 'bison', 'version': None}],
+                    [{'name': 'flex', 'version': None}],
+                    [{'name': 'gettext', 'version': None}],
+                    [{'name': 'texinfo', 'version': None}],
+                    [{'arch': [(True, 'hppa')],
+                        'name': 'expect-tcl8.3',
+                        'version': ('>=', '5.32.2')}],
+                    [{'name': 'dejagnu', 'version': None}],
+                    [{'name': 'dpatch', 'version': None}],
+                    [{'name': 'file', 'version': None}],
+                    [{'name': 'bzip2', 'version': None}],
+                    [{'name': 'lsb-release', 'version': None}]],
+                'build-depends-indep': []}
+        self.assertEqual(rel2, pkg2.relations)
+
 if __name__ == '__main__':
     unittest.main()
-- 
1.5.4.2





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