[Pkg-privacy-commits] [txtorcon] 95/96: Cherry-pick upstream patch to make tests compatible with official Mock API

Jérémy Bobbio lunar at moszumanska.debian.org
Sun Sep 6 18:34:19 UTC 2015


This is an automated email from the git hooks/post-receive script.

lunar pushed a commit to branch master
in repository txtorcon.

commit 5a7a9b2ad4a3c77a0669ef4c192e217b164e5dbc
Author: Jérémy Bobbio <lunar at debian.org>
Date:   Sun Sep 6 19:55:06 2015 +0200

    Cherry-pick upstream patch to make tests compatible with official Mock API
---
 debian/patches/0001-use-official-mock-API.patch | 77 +++++++++++++++++++++++++
 debian/patches/series                           |  1 +
 2 files changed, 78 insertions(+)

diff --git a/debian/patches/0001-use-official-mock-API.patch b/debian/patches/0001-use-official-mock-API.patch
new file mode 100644
index 0000000..c6fe479
--- /dev/null
+++ b/debian/patches/0001-use-official-mock-API.patch
@@ -0,0 +1,77 @@
+From b7b3632a97157d2892ec081220fb87ecbe6d7c80 Mon Sep 17 00:00:00 2001
+From: meejah <meejah at meejah.ca>
+Date: Sat, 5 Sep 2015 23:53:44 -0600
+Subject: [PATCH] use official mock API
+
+---
+ test/test_endpoints.py | 12 +++++++-----
+ test/test_torconfig.py |  2 +-
+ 2 files changed, 8 insertions(+), 6 deletions(-)
+
+diff --git a/test/test_endpoints.py b/test/test_endpoints.py
+index d538da3..4fe193d 100644
+--- a/test/test_endpoints.py
++++ b/test/test_endpoints.py
+@@ -115,7 +115,7 @@ class EndpointTests(unittest.TestCase):
+         endpoints.launch_tor = m
+         ep = yield TCPHiddenServiceEndpoint.private_tor(Mock(), 80,
+                                                         control_port=1234)
+-        m.assert_called()
++        self.assertTrue(m.called)
+ 
+     @defer.inlineCallbacks
+     def test_private_tor_no_control_port(self):
+@@ -123,7 +123,7 @@ class EndpointTests(unittest.TestCase):
+         from txtorcon import endpoints
+         endpoints.launch_tor = m
+         ep = yield TCPHiddenServiceEndpoint.private_tor(Mock(), 80)
+-        m.assert_called()
++        self.assertTrue(m.called)
+ 
+     @defer.inlineCallbacks
+     def test_system_tor(self):
+@@ -136,7 +136,7 @@ class EndpointTests(unittest.TestCase):
+             def bam(*args, **kw):
+                 return self.protocol
+             return bam
+-        with patch('txtorcon.endpoints.launch_tor') as m:
++        with patch('txtorcon.endpoints.launch_tor') as launch_mock:
+             with patch('txtorcon.endpoints.build_tor_connection', new_callable=boom) as btc:
+                 client = clientFromString(
+                     self.reactor,
+@@ -151,7 +151,9 @@ class EndpointTests(unittest.TestCase):
+                 port.startListening()
+                 str(port)
+                 port.tor_config
+-                m.assert_called()
++                # system_tor should be connecting to a running one,
++                # *not* launching a new one.
++                self.assertFalse(launch_mock.called)
+ 
+     @defer.inlineCallbacks
+     def test_basic(self):
+@@ -185,7 +187,7 @@ class EndpointTests(unittest.TestCase):
+         args = (50, "blarg", "Doing that thing we talked about.")
+         # kind-of cheating, test-wise?
+         ep._tor_progress_update(*args)
+-        ding.assert_called_with(*args)
++        self.assertTrue(ding.called_with(*args))
+ 
+     @patch('txtorcon.endpoints.launch_tor')
+     def test_progress_updates_private_tor(self, tor):
+diff --git a/test/test_torconfig.py b/test/test_torconfig.py
+index 278a1b1..df329fe 100644
+--- a/test/test_torconfig.py
++++ b/test/test_torconfig.py
+@@ -1086,7 +1086,7 @@ ControlPort Port''')
+ 
+         tpp.timeout_expired()
+ 
+-        tpp.transport.loseConnection.assert_called()
++        self.assertTrue(tpp.transport.loseConnection.called)
+ 
+     @defer.inlineCallbacks
+     def test_launch_timeout_process_exits(self):
+-- 
+1.9.1
+
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..14ebf60
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+0001-use-official-mock-API.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/txtorcon.git



More information about the Pkg-privacy-commits mailing list