[Pkg-privacy-commits] [pyptlib] 10/13: Refresh unittest compatibility patch
Ximin Luo
infinity0 at moszumanska.debian.org
Sat Aug 22 13:25:23 UTC 2015
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch tpo-lucid-backport
in repository pyptlib.
commit 7a3ddec06e78e3141117d3c6797597d8549e4841
Author: Jérémy Bobbio <lunar at debian.org>
Date: Fri Oct 4 14:18:40 2013 +0200
Refresh unittest compatibility patch
---
...h-unittest.TestCase-to-add-missing-assert.patch | 28 --------------
debian/patches/0001-unittest-compatibility.patch | 45 ++++++++++++++++++++++
debian/patches/series | 2 +-
3 files changed, 46 insertions(+), 29 deletions(-)
diff --git a/debian/patches/0001-Monkey-patch-unittest.TestCase-to-add-missing-assert.patch b/debian/patches/0001-Monkey-patch-unittest.TestCase-to-add-missing-assert.patch
deleted file mode 100644
index ebba348..0000000
--- a/debian/patches/0001-Monkey-patch-unittest.TestCase-to-add-missing-assert.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Bobbio?= <lunar at debian.org>
-Date: Tue, 9 Apr 2013 17:18:33 +0000
-Subject: Monkey-patch unittest.TestCase to add missing asserts for Python 2.6
-
----
- pyptlib/test/test_server.py | 9 +++++++++
- 1 file changed, 9 insertions(+)
-
-diff --git a/pyptlib/test/test_server.py b/pyptlib/test/test_server.py
-index a73fb8c..0df4451 100644
---- a/pyptlib/test/test_server.py
-+++ b/pyptlib/test/test_server.py
-@@ -4,6 +4,15 @@ import unittest
- import pyptlib
- import pyptlib.server
-
-+if not hasattr(unittest.TestCase, 'assertIsNone'):
-+ def assertIsNone(self, value):
-+ self.assertTrue(value is None)
-+ unittest.TestCase.assertIsNone = assertIsNone
-+if not hasattr(unittest.TestCase, 'assertIn'):
-+ def assertIn(self, value, collection):
-+ self.assertTrue(value in collection)
-+ unittest.TestCase.assertIn = assertIn
-+
- class testServer(unittest.TestCase):
- def test_legit_environment(self):
- """Legit environment."""
diff --git a/debian/patches/0001-unittest-compatibility.patch b/debian/patches/0001-unittest-compatibility.patch
new file mode 100644
index 0000000..756b917
--- /dev/null
+++ b/debian/patches/0001-unittest-compatibility.patch
@@ -0,0 +1,45 @@
+Author: Jérémy Bobbio <lunar at debian.org>
+Subject: Monkey-patch test cases to add missing methods for Python 2.6
+
+--- a/pyptlib/test/test_server.py
++++ b/pyptlib/test/test_server.py
+@@ -1,6 +1,15 @@
+ import os
+ import unittest
+
++if not hasattr(unittest.TestCase, 'assertIsNone'):
++ def assertIsNone(self, value):
++ self.assertTrue(value is None)
++ unittest.TestCase.assertIsNone = assertIsNone
++if not hasattr(unittest.TestCase, 'assertIn'):
++ def assertIn(self, value, collection):
++ self.assertTrue(value in collection)
++ unittest.TestCase.assertIn = assertIn
++
+ from pyptlib.config import EnvError, Config
+ from pyptlib.server import ServerTransportPlugin
+ from pyptlib.test.test_core import PluginCoreTestMixin
+--- a/pyptlib/test/test_util_subproc.py
++++ b/pyptlib/test/test_util_subproc.py
+@@ -7,6 +7,21 @@
+ from pyptlib.util.subproc import auto_killall, create_sink, proc_is_alive, Popen, SINK
+ from subprocess import PIPE
+
++if not hasattr(subprocess, 'check_output'):
++ def check_output(*popenargs, **kwargs):
++ if 'stdout' in kwargs:
++ raise ValueError('stdout argument not allowed, it will be overridden.')
++ process = Popen(stdout=PIPE, *popenargs, **kwargs)
++ output, unused_err = process.communicate()
++ retcode = process.poll()
++ if retcode:
++ cmd = kwargs.get("args")
++ if cmd is None:
++ cmd = popenargs[0]
++ raise CalledProcessError(retcode, cmd)
++ return output
++ subprocess.check_output = check_output
++
+ # We ought to run auto_killall(), instead of manually calling proc.terminate()
+ # but it's not very good form to use something inside the test for itself. :p
+
diff --git a/debian/patches/series b/debian/patches/series
index 6f5adda..3480d44 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1 @@
-0001-Monkey-patch-unittest.TestCase-to-add-missing-assert.patch
+0001-unittest-compatibility.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/pyptlib.git
More information about the Pkg-privacy-commits
mailing list