[Python-modules-commits] r34111 - in packages/plainbox/trunk/debian (6 files)

zyga-guest at users.alioth.debian.org zyga-guest at users.alioth.debian.org
Wed Sep 2 14:33:00 UTC 2015


    Date: Wednesday, September 2, 2015 @ 14:32:58
  Author: zyga-guest
Revision: 34111

debian/patches: add a pile of patches that bring in cherry-picked or
brand-new fixes for issues uncovered by python 3.5.

Added:
  packages/plainbox/trunk/debian/patches/fix-mock-tests
  packages/plainbox/trunk/debian/patches/fix-proxy-mock-tests
  packages/plainbox/trunk/debian/patches/fix-remaning-py35-issues
  packages/plainbox/trunk/debian/patches/more-mock-fixes
Modified:
  packages/plainbox/trunk/debian/changelog
  packages/plainbox/trunk/debian/patches/series

Modified: packages/plainbox/trunk/debian/changelog
===================================================================
--- packages/plainbox/trunk/debian/changelog	2015-09-02 13:42:36 UTC (rev 34110)
+++ packages/plainbox/trunk/debian/changelog	2015-09-02 14:32:58 UTC (rev 34111)
@@ -1,3 +1,10 @@
+plainbox (0.22.2-2) UNRELEASED; urgency=medium
+
+  * debian/patches: add a pile of patches that bring in cherry-picked or
+    brand-new fixes for issues uncovered by python 3.5.
+
+ -- Zygmunt Krynicki <zygmunt.krynicki at canonical.com>  Wed, 02 Sep 2015 16:21:41 +0200
+
 plainbox (0.22.2-1) unstable; urgency=medium
 
   * New upstream maintenance release

Added: packages/plainbox/trunk/debian/patches/fix-mock-tests
===================================================================
--- packages/plainbox/trunk/debian/patches/fix-mock-tests	                        (rev 0)
+++ packages/plainbox/trunk/debian/patches/fix-mock-tests	2015-09-02 14:32:58 UTC (rev 34111)
@@ -0,0 +1,195 @@
+Description: Replace unittest CamelCase method names with their underscore versions
+ Camel case methods are not mock methods we were expecting to call.  More mocks
+ were needed in the SessionResumeTests to check that all method calls from
+ _build_SessionState() are effectively called once.
+Author: Sylvain Pineau <sylvain.pineau at canonical.com>
+Origin: upstream, https://code.launchpad.net/~sylvain-pineau/checkbox/fix-python3.5-unittest/+merge/269486 
+Forwarded: not-needed
+Last-Update: 2015-08-28
+
+--- plainbox-0.22.2.orig/plainbox/impl/secure/providers/test_v1.py
++++ plainbox-0.22.2/plainbox/impl/secure/providers/test_v1.py
+@@ -98,7 +98,7 @@ class ExistingDirectoryValidatorTests(Te
+     def test_existing_directories_work(self, mock_isdir):
+         mock_isdir.return_value = True
+         self.assertEqual(self.validator(self.variable, self._PATH), None)
+-        mock_isdir.assertCalledWith(self._PATH)
++        mock_isdir.assert_called_with(self._PATH)
+ 
+     @mock.patch('os.path.isdir')
+     def test_missing_directories_dont(self, mock_isdir):
+@@ -106,7 +106,7 @@ class ExistingDirectoryValidatorTests(Te
+         self.assertEqual(
+             self.validator(self.variable, self._PATH),
+             "no such directory")
+-        mock_isdir.assertCalledWith(self._PATH)
++        mock_isdir.assert_called_with(self._PATH)
+ 
+ 
+ class AbsolutePathValidatorTests(TestCase):
+--- plainbox-0.22.2.orig/plainbox/impl/session/test_resume.py
++++ plainbox-0.22.2/plainbox/impl/session/test_resume.py
+@@ -124,7 +124,7 @@ class SessionResumeHelperTests(TestCase)
+             b'{"app_blob":null,"flags":[],"running_job_name":null,"title":null'
+             b'},"results":{}},"version":1}')
+         SessionResumeHelper([], None, None).resume(data)
+-        mocked_helper1.resume_json.assertCalledOnce()
++        mocked_helper1.resume_json.assert_called_once()
+ 
+     @mock.patch('plainbox.impl.session.resume.SessionResumeHelper2')
+     def test_resume_dispatch_v2(self, mocked_helper2):
+@@ -133,7 +133,7 @@ class SessionResumeHelperTests(TestCase)
+             b'{"app_blob":null,"flags":[],"running_job_name":null,"title":null'
+             b'},"results":{}},"version":2}')
+         SessionResumeHelper([], None, None).resume(data)
+-        mocked_helper2.resume_json.assertCalledOnce()
++        mocked_helper2.resume_json.assert_called_once()
+ 
+     @mock.patch('plainbox.impl.session.resume.SessionResumeHelper3')
+     def test_resume_dispatch_v3(self, mocked_helper3):
+@@ -143,7 +143,7 @@ class SessionResumeHelperTests(TestCase)
+             b'"running_job_name":null,"title":null'
+             b'},"results":{}},"version":3}')
+         SessionResumeHelper([], None, None).resume(data)
+-        mocked_helper3.resume_json.assertCalledOnce()
++        mocked_helper3.resume_json.assert_called_once()
+ 
+     @mock.patch('plainbox.impl.session.resume.SessionResumeHelper4')
+     def test_resume_dispatch_v4(self, mocked_helper4):
+@@ -153,7 +153,7 @@ class SessionResumeHelperTests(TestCase)
+             b'"running_job_name":null,"title":null'
+             b'},"results":{}},"version":4}')
+         SessionResumeHelper([], None, None).resume(data)
+-        mocked_helper4.resume_json.assertCalledOnce()
++        mocked_helper4.resume_json.assert_called_once()
+ 
+     @mock.patch('plainbox.impl.session.resume.SessionResumeHelper5')
+     def test_resume_dispatch_v5(self, mocked_helper5):
+@@ -163,7 +163,7 @@ class SessionResumeHelperTests(TestCase)
+             b'"running_job_name":null,"title":null'
+             b'},"results":{}},"version":5}')
+         SessionResumeHelper([], None, None).resume(data)
+-        mocked_helper5.resume_json.assertCalledOnce()
++        mocked_helper5.resume_json.assert_called_once()
+ 
+     def test_resume_dispatch_v6(self):
+         data = gzip.compress(
+@@ -361,8 +361,8 @@ class SessionStateResumeTests(TestCaseWi
+         """
+         with mock.patch.object(self.helper, attribute='_build_SessionState'):
+             self.helper._build_SessionState(self.session_repr)
+-            self.helper._build_SessionState.assertCalledOnceWith(
+-                self.session_repr, None)
++            self.helper._build_SessionState.assert_called_once_with(
++                self.session_repr)
+ 
+     def test_calls_restore_SessionState_jobs_and_results(self):
+         """
+@@ -370,11 +370,13 @@ class SessionStateResumeTests(TestCaseWi
+         _build_SessionState().
+         """
+         mpo = mock.patch.object
+-        with mpo(self.helper, '_build_SessionState'), \
+-                mpo(self.helper, '_restore_SessionState_jobs_and_results'):
++        with mpo(self.helper, '_restore_SessionState_jobs_and_results'), \
++                mpo(self.helper, '_restore_SessionState_metadata'), \
++                mpo(self.helper, '_restore_SessionState_job_list'), \
++                mpo(self.helper, '_restore_SessionState_desired_job_list'):
+             session = self.helper._build_SessionState(self.session_repr)
+             self.helper._restore_SessionState_jobs_and_results. \
+-                assertCalledOnceWith(session, self.session_repr)
++                assert_called_once_with(session, self.session_repr)
+ 
+     def test_calls_restore_SessionState_metadata(self):
+         """
+@@ -382,11 +384,13 @@ class SessionStateResumeTests(TestCaseWi
+         _build_SessionState().
+         """
+         mpo = mock.patch.object
+-        with mpo(self.helper, '_build_SessionState'), \
+-                mpo(self.helper, '_restore_SessionState_metadata'):
++        with mpo(self.helper, '_restore_SessionState_jobs_and_results'), \
++                mpo(self.helper, '_restore_SessionState_metadata'), \
++                mpo(self.helper, '_restore_SessionState_job_list'), \
++                mpo(self.helper, '_restore_SessionState_desired_job_list'):
+             session = self.helper._build_SessionState(self.session_repr)
+             self.helper._restore_SessionState_metadata. \
+-                assertCalledOnceWith(session, self.session_repr)
++                assert_called_once_with(session.metadata, self.session_repr)
+ 
+     def test_calls_restore_SessionState_desired_job_list(self):
+         """
+@@ -394,11 +398,13 @@ class SessionStateResumeTests(TestCaseWi
+         _build_SessionState().
+         """
+         mpo = mock.patch.object
+-        with mpo(self.helper, '_build_SessionState'), \
++        with mpo(self.helper, '_restore_SessionState_jobs_and_results'), \
++                mpo(self.helper, '_restore_SessionState_metadata'), \
++                mpo(self.helper, '_restore_SessionState_job_list'), \
+                 mpo(self.helper, '_restore_SessionState_desired_job_list'):
+             session = self.helper._build_SessionState(self.session_repr)
+             self.helper._restore_SessionState_desired_job_list. \
+-                assertCalledOnceWith(session, self.session_repr)
++                assert_called_once_with(session, self.session_repr)
+ 
+     def test_calls_restore_SessionState_job_list(self):
+         """
+@@ -406,10 +412,12 @@ class SessionStateResumeTests(TestCaseWi
+         _build_SessionState().
+         """
+         mpo = mock.patch.object
+-        with mpo(self.helper, '_build_SessionState'), \
+-                mpo(self.helper, '_restore_SessionState_job_list'):
++        with mpo(self.helper, '_restore_SessionState_jobs_and_results'), \
++                mpo(self.helper, '_restore_SessionState_metadata'), \
++                mpo(self.helper, '_restore_SessionState_job_list'), \
++                mpo(self.helper, '_restore_SessionState_desired_job_list'):
+             session = self.helper._build_SessionState(self.session_repr)
+-            self.helper._restore_SessionState_job_list.assertCalledOnceWith(
++            self.helper._restore_SessionState_job_list.assert_called_once_with(
+                 session, self.session_repr)
+ 
+ 
+--- plainbox-0.22.2.orig/plainbox/impl/session/test_suspend.py
++++ plainbox-0.22.2/plainbox/impl/session/test_suspend.py
+@@ -216,25 +216,29 @@ class SessionSuspendHelper1Tests(TestCas
+         data = self.helper._repr_IOLogRecord(record)
+         self.assertEqual(data, [0.0, "stdout", "YmluYXJ5IGRhdGE="])
+ 
+-    @mock.patch('plainbox.impl.session.suspend.SessionSuspendHelper')
+-    def test_repr_JobResult_with_MemoryJobResult(self, mocked_helper):
++    def test_repr_JobResult_with_MemoryJobResult(self):
+         """
+         verify that _repr_JobResult() called with MemoryJobResult
+         calls _repr_MemoryJobResult
+         """
+-        result = MemoryJobResult({})
+-        self.helper._repr_JobResult(result, self.session_dir)
+-        mocked_helper._repr_MemoryJobResult.assertCalledOnceWith(result)
++        mpo = mock.patch.object
++        with mpo(self.helper, '_repr_MemoryJobResult'):
++            result = MemoryJobResult({})
++            self.helper._repr_JobResult(result, self.session_dir)
++            self.helper._repr_MemoryJobResult.assert_called_once_with(
++                result, None)
+ 
+-    @mock.patch('plainbox.impl.session.suspend.SessionSuspendHelper')
+-    def test_repr_JobResult_with_DiskJobResult(self, mocked_helper):
++    def test_repr_JobResult_with_DiskJobResult(self):
+         """
+         verify that _repr_JobResult() called with DiskJobResult
+         calls _repr_DiskJobResult
+         """
+-        result = DiskJobResult({})
+-        self.helper._repr_JobResult(result, self.session_dir)
+-        mocked_helper._repr_DiskJobResult.assertCalledOnceWith(result)
++        mpo = mock.patch.object
++        with mpo(self.helper, '_repr_DiskJobResult'):
++            result = DiskJobResult({})
++            self.helper._repr_JobResult(result, self.session_dir)
++            self.helper._repr_DiskJobResult.assert_called_once_with(
++                result, None)
+ 
+     def test_repr_JobResult_with_junk(self):
+         """

Added: packages/plainbox/trunk/debian/patches/fix-proxy-mock-tests
===================================================================
--- packages/plainbox/trunk/debian/patches/fix-proxy-mock-tests	                        (rev 0)
+++ packages/plainbox/trunk/debian/patches/fix-proxy-mock-tests	2015-09-02 14:32:58 UTC (rev 34111)
@@ -0,0 +1,34 @@
+Description: Fix tests for plainbox.impl.proxy
+ This is another of the mock bugs that laid dormant while mock was silently
+ allowing mock.assert_ methods that didn't exist. This patch can be dropped
+ with the next release of plainbox as padme (upstream for this proxy) has been
+ added as a dependency and upstream already contains this fix.
+Author: Zygmunt Krynicki <zygmunt.krynicki at canonical.com>
+Origin: upstream
+Forwarded: not-needed
+Last-Update: 2015-09-02
+
+--- plainbox-0.22.2.orig/plainbox/impl/test_proxy.py
++++ plainbox-0.22.2/plainbox/impl/test_proxy.py
+@@ -276,13 +276,16 @@ class proxy_as_function(unittest.TestCas
+ 
+     def test_context_manager_methods_v2(self):
+         exc = Exception("boom")
++        exc_info = ()
+         with self.assertRaisesRegex(Exception, "boom"):
+-            with self.proxy:
+-                raise exc
++            try:
++                with self.proxy:
++                    raise exc
++            except Exception:
++                exc_info = sys.exc_info()
++                raise
+         self.obj.__enter__.assert_called_once_with()
+-        # XXX: it's called with (Exception, exc, traceback) but I don't know
+-        # how to reach the traceback here
+-        self.obj.__exit__.assert_called_once
++        self.obj.__exit__.assert_called_once_with(*exc_info)
+ 
+     def test_hasattr_parity(self):
+         class C():

Added: packages/plainbox/trunk/debian/patches/fix-remaning-py35-issues
===================================================================
--- packages/plainbox/trunk/debian/patches/fix-remaning-py35-issues	                        (rev 0)
+++ packages/plainbox/trunk/debian/patches/fix-remaning-py35-issues	2015-09-02 14:32:58 UTC (rev 34111)
@@ -0,0 +1,91 @@
+Description: <short summary of the patch>
+ This patch fixes the remaining python 3.5 issues. I'll apply the patch to
+ trunk of plainbox so if you are trying to refresh this patch in Debian or
+ Ubuntu, just drop it and get the most recent release instead.
+Origin: vendor
+Forwarded: not-needed
+Last-Update: 2015-09-02
+
+--- plainbox-0.22.2.orig/plainbox/impl/secure/qualifiers.py
++++ plainbox-0.22.2/plainbox/impl/secure/qualifiers.py
+@@ -32,6 +32,7 @@ import logging
+ import operator
+ import os
+ import re
++import sre_constants
+ 
+ from plainbox.abc import IJobQualifier
+ from plainbox.i18n import gettext as _
+@@ -140,7 +141,15 @@ class RegExpJobQualifier(SimpleQualifier
+         Initialize a new RegExpJobQualifier with the specified pattern.
+         """
+         super().__init__(origin, inclusive)
+-        self._pattern = re.compile(pattern)
++        try:
++            self._pattern = re.compile(pattern)
++        except sre_constants.error as exc:
++            assert len(exc.args) == 1
++            # XXX: This is a bit crazy but this lets us have identical error
++            # messages across python3.2 all the way to 3.5. I really really
++            # wish there was a better way at fixing this.
++            exc.args = (re.sub(" at position \d+", "", exc.args[0]), )
++            raise exc
+         self._pattern_text = pattern
+ 
+     def get_simple_match(self, job):
+--- plainbox-0.22.2.orig/plainbox/impl/unit/validators.py
++++ plainbox-0.22.2/plainbox/impl/unit/validators.py
+@@ -27,6 +27,7 @@ import itertools
+ import logging
+ import os
+ import shlex
++import sys
+ 
+ from plainbox.i18n import gettext as _
+ from plainbox.i18n import ngettext
+@@ -271,9 +272,12 @@ class CorrectFieldValueValidator(FieldVa
+             perform its check.
+         """
+         super().__init__(message)
+-        spec = inspect.getargspec(correct_fn)
++        if sys.version_info[:2] >= (3, 5):
++            has_two_args = len(inspect.signature(correct_fn).parameters) == 2
++        else:
++            has_two_args = len(inspect.getargspec(correct_fn).args) == 2
+         self.correct_fn = correct_fn
+-        self.correct_fn_needs_unit = len(spec.args) == 2
++        self.correct_fn_needs_unit = has_two_args
+         self.kind = kind or self.default_kind
+         self.severity = severity or self.default_severity
+         self.onlyif = onlyif
+--- plainbox-0.22.2.orig/plainbox/impl/xparsers.py
++++ plainbox-0.22.2/plainbox/impl/xparsers.py
+@@ -61,6 +61,7 @@ import itertools
+ import re
+ import sre_constants
+ import sre_parse
++import sys
+ 
+ from plainbox.i18n import gettext as _
+ from plainbox.impl import pod
+@@ -231,12 +232,19 @@ class Re(Node):
+         try:
+             pyre_ast = sre_parse.parse(text)
+         except sre_constants.error as exc:
++            assert len(exc.args) == 1
++            # XXX: This is a bit crazy but this lets us have identical error
++            # messages across python3.2 all the way to 3.5. I really really
++            # wish there was a better way at fixing this.
++            exc.args = (re.sub(" at position \d+", "", exc.args[0]), )
+             return ReErr(lineno, col_offset, text, exc)
+         else:
+             # Check if the AST of this regular expression is composed
+             # of just a flat list of 'literal' nodes. In other words,
+             # check if it is a simple string match in disguise
+-            if all(t == 'literal' for t, rest in pyre_ast):
++            if ((sys.version_info[:2] >= (3, 5) and
++                    all(t == sre_constants.LITERAL for t, rest in pyre_ast)) or
++                    all(t == 'literal' for t, rest in pyre_ast)):
+                 return ReFixed(lineno, col_offset, text)
+             else:
+                 # NOTE: we might save time by calling some internal function to

Added: packages/plainbox/trunk/debian/patches/more-mock-fixes
===================================================================
--- packages/plainbox/trunk/debian/patches/more-mock-fixes	                        (rev 0)
+++ packages/plainbox/trunk/debian/patches/more-mock-fixes	2015-09-02 14:32:58 UTC (rev 34111)
@@ -0,0 +1,241 @@
+Description: Batched fixes to everything that was mock-broken
+ This patch contains a collection of cherry-picked fixes to various parts
+ of plainbox that were just silently broken because of mock's ignorance
+ of non-existing assertion methods.
+Origin: upstream
+Forwarded: not-needed
+Last-Update: 2015-09-02
+
+--- plainbox-0.22.2.orig/plainbox/impl/secure/test_plugins.py
++++ plainbox-0.22.2/plainbox/impl/secure/test_plugins.py
+@@ -123,7 +123,7 @@ class PlugInCollectionBaseTests(TestCase
+         passed to the initializer.
+         """
+         col = DummyPlugInCollection(load=True)
+-        col.load.assert_called()
++        col.load.assert_called_once_with()
+ 
+     def test_defaults(self):
+         """
+@@ -329,7 +329,7 @@ class PkgResourcesPlugInCollectionTests(
+         # Load plugins
+         self.col.load()
+         # Ensure that pkg_resources were interrogated
+-        mock_iter.assert_calledwith(self._NAMESPACE)
++        mock_iter.assert_called_with(self._NAMESPACE)
+         # Ensure that both entry points were loaded
+         mock_ep1.load.assert_called_with()
+         mock_ep2.load.assert_called_with()
+@@ -350,7 +350,7 @@ class PkgResourcesPlugInCollectionTests(
+         # Load plugins
+         self.col.load()
+         # Ensure that pkg_resources were interrogated
+-        mock_iter.assert_calledwith(self._NAMESPACE)
++        mock_iter.assert_called_with(self._NAMESPACE)
+         # Ensure that both entry points were loaded
+         mock_ep1.load.assert_called_with()
+         mock_ep2.load.assert_called_with()
+@@ -514,7 +514,7 @@ class FsPlugInCollectionTests(TestCase):
+                  {'encoding': 'UTF-8'}),
+             ])
+         # Ensure that no exception was logged
+-        mock_logger.error.assert_not_called()
++        self.assertEqual(mock_logger.error.mock_calls, [])
+         # Ensure that everything was okay
+         self.assertEqual(col.problem_list, [])
+         # Ensure that both files got added
+--- plainbox-0.22.2.orig/plainbox/impl/session/test_resume.py
++++ plainbox-0.22.2/plainbox/impl/session/test_resume.py
+@@ -117,53 +117,101 @@ class SessionResumeExceptionTests(TestCa
+ 
+ class SessionResumeHelperTests(TestCase):
+ 
+-    @mock.patch('plainbox.impl.session.resume.SessionResumeHelper1')
+-    def test_resume_dispatch_v1(self, mocked_helper1):
+-        data = gzip.compress(
+-            b'{"session":{"desired_job_list":[],"jobs":{},"metadata":'
+-            b'{"app_blob":null,"flags":[],"running_job_name":null,"title":null'
+-            b'},"results":{}},"version":1}')
+-        SessionResumeHelper([], None, None).resume(data)
+-        mocked_helper1.resume_json.assert_called_once()
+-
+-    @mock.patch('plainbox.impl.session.resume.SessionResumeHelper2')
+-    def test_resume_dispatch_v2(self, mocked_helper2):
+-        data = gzip.compress(
+-            b'{"session":{"desired_job_list":[],"jobs":{},"metadata":'
+-            b'{"app_blob":null,"flags":[],"running_job_name":null,"title":null'
+-            b'},"results":{}},"version":2}')
+-        SessionResumeHelper([], None, None).resume(data)
+-        mocked_helper2.resume_json.assert_called_once()
+-
+-    @mock.patch('plainbox.impl.session.resume.SessionResumeHelper3')
+-    def test_resume_dispatch_v3(self, mocked_helper3):
+-        data = gzip.compress(
+-            b'{"session":{"desired_job_list":[],"jobs":{},"metadata":'
+-            b'{"app_blob":null,"app_id":null,"flags":[],'
+-            b'"running_job_name":null,"title":null'
+-            b'},"results":{}},"version":3}')
+-        SessionResumeHelper([], None, None).resume(data)
+-        mocked_helper3.resume_json.assert_called_once()
+-
+-    @mock.patch('plainbox.impl.session.resume.SessionResumeHelper4')
+-    def test_resume_dispatch_v4(self, mocked_helper4):
+-        data = gzip.compress(
+-            b'{"session":{"desired_job_list":[],"jobs":{},"metadata":'
+-            b'{"app_blob":null,"app_id":null,"flags":[],'
+-            b'"running_job_name":null,"title":null'
+-            b'},"results":{}},"version":4}')
+-        SessionResumeHelper([], None, None).resume(data)
+-        mocked_helper4.resume_json.assert_called_once()
+-
+-    @mock.patch('plainbox.impl.session.resume.SessionResumeHelper5')
+-    def test_resume_dispatch_v5(self, mocked_helper5):
+-        data = gzip.compress(
+-            b'{"session":{"desired_job_list":[],"jobs":{},"metadata":'
+-            b'{"app_blob":null,"app_id":null,"flags":[],'
+-            b'"running_job_name":null,"title":null'
+-            b'},"results":{}},"version":5}')
+-        SessionResumeHelper([], None, None).resume(data)
+-        mocked_helper5.resume_json.assert_called_once()
++    def test_resume_dispatch_v1(self):
++        helper1 = SessionResumeHelper1
++        with mock.patch.object(helper1, 'resume_json'):
++            data = gzip.compress(
++                b'{"session":{"desired_job_list":[],"jobs":{},"metadata":'
++                b'{"app_blob":null,"flags":[],"running_job_name":null,'
++                b'"title":null},"results":{}},"version":1}')
++            SessionResumeHelper([], None, None).resume(data)
++            helper1.resume_json.assert_called_once_with(
++                {'session': {'jobs': {},
++                             'metadata': {'title': None,
++                                          'running_job_name': None,
++                                          'app_blob': None,
++                                          'flags': []},
++                             'desired_job_list': [],
++                             'results': {}},
++                 'version': 1}, None)
++
++    def test_resume_dispatch_v2(self):
++        helper2 = SessionResumeHelper2
++        with mock.patch.object(helper2, 'resume_json'):
++            data = gzip.compress(
++                b'{"session":{"desired_job_list":[],"jobs":{},"metadata":'
++                b'{"app_blob":null,"flags":[],"running_job_name":null,'
++                b'"title":null},"results":{}},"version":2}')
++            SessionResumeHelper([], None, None).resume(data)
++            helper2.resume_json.assert_called_once_with(
++                {'session': {'jobs': {},
++                             'metadata': {'title': None,
++                                          'running_job_name': None,
++                                          'app_blob': None,
++                                          'flags': []},
++                             'desired_job_list': [],
++                             'results': {}},
++                 'version': 2}, None)
++
++    def test_resume_dispatch_v3(self):
++        helper3 = SessionResumeHelper3
++        with mock.patch.object(helper3, 'resume_json'):
++            data = gzip.compress(
++                b'{"session":{"desired_job_list":[],"jobs":{},"metadata":'
++                b'{"app_blob":null,"app_id":null,"flags":[],'
++                b'"running_job_name":null,"title":null'
++                b'},"results":{}},"version":3}')
++            SessionResumeHelper([], None, None).resume(data)
++            helper3.resume_json.assert_called_once_with(
++                {'session': {'jobs': {},
++                             'metadata': {'title': None,
++                                          'app_id': None,
++                                          'running_job_name': None,
++                                          'app_blob': None,
++                                          'flags': []},
++                             'desired_job_list': [],
++                             'results': {}},
++                 'version': 3}, None)
++
++    def test_resume_dispatch_v4(self):
++        helper4 = SessionResumeHelper4
++        with mock.patch.object(helper4, 'resume_json'):
++            data = gzip.compress(
++                b'{"session":{"desired_job_list":[],"jobs":{},"metadata":'
++                b'{"app_blob":null,"app_id":null,"flags":[],'
++                b'"running_job_name":null,"title":null'
++                b'},"results":{}},"version":4}')
++            SessionResumeHelper([], None, None).resume(data)
++            helper4.resume_json.assert_called_once_with(
++                {'session': {'jobs': {},
++                             'metadata': {'title': None,
++                                          'app_id': None,
++                                          'running_job_name': None,
++                                          'app_blob': None,
++                                          'flags': []},
++                             'desired_job_list': [],
++                             'results': {}},
++                 'version': 4}, None)
++
++    def test_resume_dispatch_v5(self):
++        helper5 = SessionResumeHelper5
++        with mock.patch.object(helper5, 'resume_json'):
++            data = gzip.compress(
++                b'{"session":{"desired_job_list":[],"jobs":{},"metadata":'
++                b'{"app_blob":null,"app_id":null,"flags":[],'
++                b'"running_job_name":null,"title":null'
++                b'},"results":{}},"version":5}')
++            SessionResumeHelper([], None, None).resume(data)
++            helper5.resume_json.assert_called_once_with(
++                {'session': {'jobs': {},
++                             'metadata': {'title': None,
++                                          'app_id': None,
++                                          'running_job_name': None,
++                                          'app_blob': None,
++                                          'flags': []},
++                             'desired_job_list': [],
++                             'results': {}},
++                 'version': 5}, None)
+ 
+     def test_resume_dispatch_v6(self):
+         data = gzip.compress(
+--- plainbox-0.22.2.orig/plainbox/impl/session/test_state.py
++++ plainbox-0.22.2/plainbox/impl/session/test_state.py
+@@ -994,7 +994,7 @@ class SessionDeviceContextTests(SignalTe
+         with mock.patch.object(self.ctx, '_compute_execution_ctrl_list') as m:
+             result = self.ctx.execution_controller_list
+         self.assertIs(result, m())
+-        m.assert_called_once()
++        m.assert_any_call()
+ 
+     def test_execution_controller_list__cached(self):
+         """
+@@ -1007,7 +1007,7 @@ class SessionDeviceContextTests(SignalTe
+             result1 = self.ctx.execution_controller_list
+             result2 = self.ctx.execution_controller_list
+         self.assertIs(result1, result2)
+-        m.assert_called_once()
++        m.assert_any_call()
+         self.assertIn(
+             SessionDeviceContext._CACHE_EXECUTION_CTRL_LIST,
+             self.ctx._shared_cache)
+--- plainbox-0.22.2.orig/plainbox/impl/test_ctrl.py
++++ plainbox-0.22.2/plainbox/impl/test_ctrl.py
+@@ -226,7 +226,7 @@ class CheckBoxSessionStateControllerTest
+         self.assertIs(
+             session_state.job_state_map[job.id].result, result)
+         # Ensure that signals got fired
+-        session_state.on_job_state_map_changed.assert_called_once()
++        session_state.on_job_state_map_changed.assert_called_once_with()
+         session_state.on_job_result_changed.assert_called_once_with(
+             job, result)
+ 
+--- plainbox-0.22.2.orig/plainbox/impl/test_pod.py
++++ plainbox-0.22.2/plainbox/impl/test_pod.py
+@@ -249,8 +249,8 @@ class FieldCollectionTests(TestCase):
+         """.inspect_namespace() calls add_field() on each Field."""
+         with mock.patch.object(self.fc, 'add_field') as mock_add_field:
+             self.fc.inspect_namespace(self.ns, 'cls')
+-        mock_add_field.assert_has_call(self.foo, 'cls')
+-        mock_add_field.assert_has_call(self.bar, 'cls')
++            calls = [mock.call(self.foo, 'cls'), mock.call(self.bar, 'cls')]
++            mock_add_field.assert_has_calls(calls, any_order=True)
+ 
+     def test_inspect_namespace_sets_field_name(self):
+         """.inspect_namespace() sets .name of each field."""

Modified: packages/plainbox/trunk/debian/patches/series
===================================================================
--- packages/plainbox/trunk/debian/patches/series	2015-09-02 13:42:36 UTC (rev 34110)
+++ packages/plainbox/trunk/debian/patches/series	2015-09-02 14:32:58 UTC (rev 34111)
@@ -2,3 +2,7 @@
 silence-logging-failure
 documentation-theme
 fix-packaging-metadata-units
+fix-mock-tests
+more-mock-fixes
+fix-proxy-mock-tests
+fix-remaning-py35-issues




More information about the Python-modules-commits mailing list