diff -Nru checkbox-0.18/debian/changelog checkbox-0.18/debian/changelog --- checkbox-0.18/debian/changelog 2015-07-22 21:54:56.000000000 +0200 +++ checkbox-0.18/debian/changelog 2015-09-07 18:34:33.000000000 +0200 @@ -1,3 +1,15 @@ +checkbox (0.18-0ubuntu3) wily; urgency=medium + + * debian/patches/fix-lp1483410-part1: Correct the method of loading unit + tests so that package modules are not loaded as top-level modules + themselves. (Closes LP: #1483410) + * debian/patches/fix-lp1483410-part2: Iterate over a copy of dictionary keys + so that the loop can correctly remove elements without raising exceptions. + * debian/control: build-depend on python3-dbus and python3-gi as apparently + tests are importing modules that depend on those. + + -- Sylvain Pineau Mon, 07 Sep 2015 17:49:56 +0200 + checkbox (0.18-0ubuntu2) utopic; urgency=medium * setup.py: Only build the checkbox-old subdirectory, as nothing else diff -Nru checkbox-0.18/debian/patches/fix-lp1483410-part1 checkbox-0.18/debian/patches/fix-lp1483410-part1 --- checkbox-0.18/debian/patches/fix-lp1483410-part1 1970-01-01 01:00:00.000000000 +0100 +++ checkbox-0.18/debian/patches/fix-lp1483410-part1 2015-09-07 17:48:19.000000000 +0200 @@ -0,0 +1,29 @@ +Description: Fix LP: #1483410 + This patch corrects a simple bug in the test suite loader that was previously + silently compesated by eariler versions of the standard library. The bug has + caused us to effectively import modules and pacakges from _inside_ the + checkbox-old/checkbox package. For example, the module 'checkbox-old/checkbox.dbus' + was imported simply as 'dbus'. This caused all kinds of understandable havoc. + The fix relies on the second, optional argument to defaultTestLoader.discover() + which lets us specify that we want to load 'checkbox-old/checkbox' from the parent + directory. +Author: Zygmunt Krynicki +Origin: upstream +Bug-Ubuntu: https://launchpad.net/bugs/1483410 +Forwarded: no +Last-Update: 2015-08011 + +--- checkbox-0.18.orig/checkbox-old/checkbox/tests/__init__.py ++++ checkbox-0.18/checkbox-old/checkbox/tests/__init__.py +@@ -35,8 +35,9 @@ def load_unit_tests(): + """ + # Discover all unit tests. By simple convention those are kept in + # python modules that start with the word 'test_' . +- return defaultTestLoader.discover( +- os.path.dirname(getabsfile(checkbox))) ++ start_dir = os.path.dirname(getabsfile(checkbox)) ++ top_level_dir = os.path.normpath(os.path.join(start_dir, '..')) ++ return defaultTestLoader.discover(start_dir, top_level_dir=top_level_dir) + + + def test_suite(): diff -Nru checkbox-0.18/debian/patches/fix-lp1483410-part2 checkbox-0.18/debian/patches/fix-lp1483410-part2 --- checkbox-0.18/debian/patches/fix-lp1483410-part2 1970-01-01 01:00:00.000000000 +0100 +++ checkbox-0.18/debian/patches/fix-lp1483410-part2 2015-09-07 18:25:52.000000000 +0200 @@ -0,0 +1,21 @@ +Description: Don't remove keys from dictionary being iterated + I'm not quite sure how this worked earlier but it's clearly wrong. This patch + simply makes the outer loop iterate over a copy of all the keys in the + self.devices dictionary. This makes the .pop() function a few lines below + function as expected. +Author: Zygmunt Krynicki +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1483410 +Forwarded: no +Last-Update: 2015-09-07 + +--- checkbox-0.18.orig/checkbox-old/checkbox/parsers/udevadm.py ++++ checkbox-0.18/checkbox-old/checkbox/parsers/udevadm.py +@@ -803,7 +803,7 @@ class UdevadmParser(object): + self.devices[device._raw_path] = device + stack.append(device) + +- for device in self.devices.values(): ++ for device in list(self.devices.values()): + if device.category in ("NETWORK", "WIRELESS", "OTHER"): + dev_interface = [ + d for d in self.devices.values() diff -Nru checkbox-0.18/debian/patches/series checkbox-0.18/debian/patches/series --- checkbox-0.18/debian/patches/series 2015-07-21 14:46:14.000000000 +0200 +++ checkbox-0.18/debian/patches/series 2015-09-07 18:26:31.000000000 +0200 @@ -1 +1,3 @@ vendorized_packages_removal.patch +fix-lp1483410-part1 +fix-lp1483410-part2