Package: pyparted
Version: 3.11.2-2
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu disco ubuntu-patch

Dear Herbert,

In Ubuntu, we have applied the attached patch to pyparted in order to enable
build-time tests of the package.  It appears you have similarly tried to fix
the tests with one of your distro patches, however the dh_auto_test target
is still empty in your package and no tests are run, so perhaps this work
was incomplete?

With the attached patch, the tests run and pass on all Ubuntu architectures. 
I notice that you had skipped some of the tests as "failing on some
architectures", but I assume that the build-dependency fixes are sufficient
to let the tests pass on all other Debian architectures as well.

Hope that helps,
-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                   https://www.debian.org/
slanga...@ubuntu.com                                     vor...@debian.org
diff -Nru pyparted-3.11.2/debian/control pyparted-3.11.2/debian/control
--- pyparted-3.11.2/debian/control      2019-02-06 04:24:54.000000000 -0800
+++ pyparted-3.11.2/debian/control      2019-02-11 12:19:23.000000000 -0800
@@ -5,12 +5,12 @@
 Build-Depends: debhelper (>= 11),
                dh-python,
                libparted-dev,
+               parted,
                pkg-config,
-               python-all-dbg (>= 2.6.6-13~),
                python-all-dev (>= 2.6.6-13~),
                python-six,
-               python3-all-dbg,
-               python3-all-dev
+               python3-all-dev,
+               python3-six
 Standards-Version: 4.3.0
 Homepage: https://github.com/dcantrell/pyparted
 Vcs-Git: https://salsa.debian.org/debian/pyparted.git
diff -Nru pyparted-3.11.2/debian/patches/fix-unit-tests.patch 
pyparted-3.11.2/debian/patches/fix-unit-tests.patch
--- pyparted-3.11.2/debian/patches/fix-unit-tests.patch 1969-12-31 
16:00:00.000000000 -0800
+++ pyparted-3.11.2/debian/patches/fix-unit-tests.patch 2017-07-17 
03:39:45.000000000 -0700
@@ -0,0 +1,26 @@
+Description: Fix two unit tests failing due to expecting wrong exceptions
+ _ped's *_flag_get_name methods now throw a PartedException instead of
+ ValueError on unsupported flags.
+Author: Ɓukasz 'sil2100' Zemczak <lukasz.zemc...@ubuntu.com>
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/pyparted/+bug/1695058
+Forwarded: https://github.com/dcantrell/pyparted/pull/43
+--- a/tests/test__ped_ped.py
++++ b/tests/test__ped_ped.py
+@@ -48,7 +48,7 @@
+             self.assertNotEqual(_ped.partition_flag_get_name(attr), "", 
"Could not get name for flag _ped.%s" % f)
+ 
+         self.assertRaises(ValueError, _ped.partition_flag_get_name, -1)
+-        self.assertRaises(ValueError, _ped.partition_flag_get_name, 1000)
++        self.assertRaises(_ped.PartedException, _ped.partition_flag_get_name, 
1000)
+ 
+ class PartitionFlagGetByNameTestCase(unittest.TestCase):
+     def runTest(self):
+@@ -82,7 +82,7 @@
+             self.assertNotEqual(_ped.disk_flag_get_name(f), "", "Could not 
get name for flag %s" % f)
+ 
+         self.assertRaises(ValueError, _ped.disk_flag_get_name, -1)
+-        self.assertRaises(ValueError, _ped.disk_flag_get_name, 1000)
++        self.assertRaises(_ped.PartedException, _ped.disk_flag_get_name, 1000)
+ 
+ class DiskFlagGetByNameTestCase(unittest.TestCase):
+     def runTest(self):
diff -Nru pyparted-3.11.2/debian/patches/series 
pyparted-3.11.2/debian/patches/series
--- pyparted-3.11.2/debian/patches/series       2019-02-06 04:09:49.000000000 
-0800
+++ pyparted-3.11.2/debian/patches/series       2019-02-11 12:11:07.000000000 
-0800
@@ -2,4 +2,4 @@
 typo_iff.patch
 typo-pydisck-h.patch
 no-last-flag-check.patch
-unknow_parttition_flag.patch
+fix-unit-tests.patch
diff -Nru pyparted-3.11.2/debian/patches/unknow_parttition_flag.patch 
pyparted-3.11.2/debian/patches/unknow_parttition_flag.patch
--- pyparted-3.11.2/debian/patches/unknow_parttition_flag.patch 2019-02-06 
04:09:49.000000000 -0800
+++ pyparted-3.11.2/debian/patches/unknow_parttition_flag.patch 1969-12-31 
16:00:00.000000000 -0800
@@ -1,69 +0,0 @@
-Description: comment assertRaises
-             skip DiskNewLabeledTestCase
-             skip FileSystemProbeTestCase - because of CI
-             skip FileSystemProbeSpecificTestCase - because of CI
-             skip GetLabelsTestCase. It fails on some archs
-Author: Herbert Parentes Fortes Neto <h...@debian.org>
-Last-Update: 2018-06-25
-Index: pyparted/tests/test__ped_ped.py
-===================================================================
---- pyparted.orig/tests/test__ped_ped.py
-+++ pyparted/tests/test__ped_ped.py
-@@ -48,7 +48,7 @@ class PartitionFlagGetNameTestCase(unitt
-             self.assertNotEqual(_ped.partition_flag_get_name(attr), "", 
"Could not get name for flag _ped.%s" % f)
- 
-         self.assertRaises(ValueError, _ped.partition_flag_get_name, -1)
--        self.assertRaises(ValueError, _ped.partition_flag_get_name, 1000)
-+        # self.assertRaises(ValueError, _ped.partition_flag_get_name, 1000)
- 
- class PartitionFlagGetByNameTestCase(unittest.TestCase):
-     def runTest(self):
-@@ -82,7 +82,7 @@ class DiskFlagGetNameTestCase(unittest.T
-             self.assertNotEqual(_ped.disk_flag_get_name(f), "", "Could not 
get name for flag %s" % f)
- 
-         self.assertRaises(ValueError, _ped.disk_flag_get_name, -1)
--        self.assertRaises(ValueError, _ped.disk_flag_get_name, 1000)
-+        # self.assertRaises(ValueError, _ped.disk_flag_get_name, 1000)
- 
- class DiskFlagGetByNameTestCase(unittest.TestCase):
-     def runTest(self):
-@@ -255,6 +255,7 @@ class DiskTypeGetNextTestCase(unittest.T
- 
-         self.assertRaises(IndexError, _ped.disk_type_get_next, lst[-1])
- 
-+@unittest.skip('Skip because of Debian CI tests. No geometry')
- class FileSystemProbeTestCase(RequiresFileSystem):
-     def runTest(self):
-         ty = _ped.file_system_probe(self._geometry)
-@@ -265,6 +266,7 @@ class FileSystemProbeTestCase(RequiresFi
-             else:
-                 self.assertNotEqual(ty.name, name)
- 
-+@unittest.skip('Skip because of Debian CI tests. No geometry')
- class FileSystemProbeSpecificTestCase(RequiresFileSystem):
-     def runTest(self):
-         for (name, ty,) in self._fileSystemType.items():
-Index: pyparted/tests/test__ped_disk.py
-===================================================================
---- pyparted.orig/tests/test__ped_disk.py
-+++ pyparted/tests/test__ped_disk.py
-@@ -31,6 +31,7 @@ class DiskNewUnlabeledTestCase(RequiresD
-     def runTest(self):
-         self.assertRaises(_ped.DiskLabelException, _ped.Disk, self._device)
- 
-+@unittest.skip("For Debian CI tests.")
- class DiskNewLabeledTestCase(RequiresLabeledDevice):
-     def runTest(self):
-         result = _ped.Disk(self._device)
-Index: pyparted/tests/test_parted_parted.py
-===================================================================
---- pyparted.orig/tests/test_parted_parted.py
-+++ pyparted/tests/test_parted_parted.py
-@@ -46,6 +46,7 @@ class BytesToSectorsTestCase(unittest.Te
-                              parted.sizeToSectors(7777.0, "B", 512))
-         self.assertEqual(parted.sizeToSectors(1000, "B", 512), 2)
- 
-+@unittest.skip('It fails on some architectures.')
- class GetLabelsTestCase(unittest.TestCase):
-     def runTest(self):
-         self.assertGreater(len(parted.getLabels()), 0)
diff -Nru pyparted-3.11.2/debian/rules pyparted-3.11.2/debian/rules
--- pyparted-3.11.2/debian/rules        2019-02-06 04:09:49.000000000 -0800
+++ pyparted-3.11.2/debian/rules        2019-02-11 12:11:24.000000000 -0800
@@ -13,10 +13,6 @@
        rm -rf debian/python-parted-dbg/usr/lib/python2.7/dist-packages/parted/
        rm -rf debian/python3-parted-dbg/usr/lib/python3*/dist-packages/parted/
 
-override_dh_auto_test:
-       # make test
-
-
 override_dh_clean:
        dh_clean
        rm -fr debian/python3-parted-dbg

Reply via email to