Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-mockito for openSUSE:Factory checked in at 2026-04-28 16:40:11 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-mockito (Old) and /work/SRC/openSUSE:Factory/.python-mockito.new.11940 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-mockito" Tue Apr 28 16:40:11 2026 rev:16 rq:1349771 version:2.0.4 Changes: -------- --- /work/SRC/openSUSE:Factory/python-mockito/python-mockito.changes 2026-04-09 16:11:29.581839853 +0200 +++ /work/SRC/openSUSE:Factory/.python-mockito.new.11940/python-mockito.changes 2026-04-28 16:40:12.723078210 +0200 @@ -1,0 +2,8 @@ +Tue Apr 28 10:12:01 UTC 2026 - John Paul Adrian Glaubitz <[email protected]> + +- Update to 2.0.4 + * Proof-read docs + * Reorder function docs + * Clarify unused stub error message + +------------------------------------------------------------------- Old: ---- 2.0.3.tar.gz New: ---- 2.0.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-mockito.spec ++++++ --- /var/tmp/diff_new_pack.LCbMuS/_old 2026-04-28 16:40:13.503110468 +0200 +++ /var/tmp/diff_new_pack.LCbMuS/_new 2026-04-28 16:40:13.507110634 +0200 @@ -18,7 +18,7 @@ %{?sle15_python_module_pythons} Name: python-mockito -Version: 2.0.3 +Version: 2.0.4 Release: 0 Summary: Spying framework License: MIT ++++++ 2.0.3.tar.gz -> 2.0.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mockito-python-2.0.3/CHANGES.txt new/mockito-python-2.0.4/CHANGES.txt --- old/mockito-python-2.0.3/CHANGES.txt 2026-03-13 12:23:42.000000000 +0100 +++ new/mockito-python-2.0.4/CHANGES.txt 2026-04-15 11:19:19.000000000 +0200 @@ -32,7 +32,7 @@ from mockito import InOrder in_order = InOrder(cat) # <== pass multiple objects for cross-mock verification! in_order.verify(cat).meow() - inorder.verify(cat).purr() + in_order.verify(cat).purr() - The legacy in-order verification mode (``inorder.verify(...)``) is deprecated in favor of ``InOrder(...)``. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mockito-python-2.0.3/docs/any-and-ellipses.rst new/mockito-python-2.0.4/docs/any-and-ellipses.rst --- old/mockito-python-2.0.3/docs/any-and-ellipses.rst 2026-03-13 12:23:42.000000000 +0100 +++ new/mockito-python-2.0.4/docs/any-and-ellipses.rst 2026-04-15 11:19:19.000000000 +0200 @@ -1,7 +1,7 @@ Any markers and ellipses ========================= -Let's look at how the Ellipsis marker (`...`) works in mockito. +Let's look at how the Ellipsis marker (``...``) works in mockito. Assume: @@ -17,7 +17,7 @@ when(C).function(...) -The sole `...` denotes a "whatever" matcher. +The sole ``...`` denotes a "whatever" matcher. These are allowed: @@ -39,7 +39,7 @@ when(C).function(2, ...) -The trailing `...` denotes a rest matcher. We match up to the `2`; the rest is accepted. +The trailing ``...`` denotes a rest matcher. We match up to the `2`; the rest is accepted. :: @@ -67,10 +67,10 @@ function(1, 2, three=3) -Fixed-position ellipsis (`...`) as `any` +Relation to `any` ---------------------------------------- -`...` can also be used in a fixed position as an ad-hoc `any` matcher. +``...`` can also be used in a fixed position as an ad-hoc `any` matcher. Assume: @@ -149,12 +149,13 @@ Relation to `*args` ------------------- -If you want to match `*args` (multiple arguments), use `args`: +If you want to match `*args` (multiple arguments), use ``args``: :: def sum(*args): ... + from mockito import args when(C).sum(1, 2, *args) Allows: @@ -164,7 +165,7 @@ sum(1, 2, 3) sum(1, 2, 3, 4) -That is similar to plain trailing `...`, but `args` also composes with keyword arguments. +That is similar to plain trailing ``...``, but ``args`` also composes with keyword arguments. Assume: @@ -172,6 +173,7 @@ def sum(*args, init=0): ... + from mockito import args when(C).sum(1, 2, *args, init=5) Allows: @@ -187,7 +189,7 @@ when(C).sum(1, 2, ..., init=5) -uses fixed-position `...` (one value), so it allows: +uses fixed-position ``...`` (one value), so it allows: :: @@ -210,10 +212,11 @@ when(C).fetch("https://example.com/", retry=..., ...) -but that's not valid Python syntax. Use `kwargs` instead: +but that's not valid Python syntax. Use ``kwargs`` instead: :: + from mockito import kwargs when(C).fetch("https://example.com/", retry=..., **kwargs) Allows: @@ -226,6 +229,7 @@ :: + from mockito import kwargs when(C).fetch(..., retry=2, **kwargs) Allows: @@ -236,5 +240,5 @@ fetch("https://foobar.com/", retry=2) fetch("https://foobar.com/", retry=2, headers={}) -Use `kwargs` as the rest marker where `...` is not syntactically available +Use ``kwargs`` as the rest marker where ``...`` is not syntactically available because specific keyword arguments are already configured. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mockito-python-2.0.3/docs/mock-shorthands.rst new/mockito-python-2.0.4/docs/mock-shorthands.rst --- old/mockito-python-2.0.3/docs/mock-shorthands.rst 2026-03-13 12:23:42.000000000 +0100 +++ new/mockito-python-2.0.4/docs/mock-shorthands.rst 2026-04-15 11:19:19.000000000 +0200 @@ -51,21 +51,19 @@ you also need to define the context/with handlers:: - resp = mock({ - "__aenter__": ..., - "async text": lambda: "Fake!" - }) - session = mock({ + "async get": lambda: resp, # <== install async method with *args, **kwargs + # equivalent to when(session).get(...).thenReturn(resp) + }) + resp = mock({ # since __aenter__ is async by protocol "async __aenter__" is not needed (but allowed) "__aenter__": ..., # <== ... denotes to install a standard return value of self # it always installs a standard __aexit__ returning None or False # if not provided by the user - - "async get": lambda: resp, # <== install async method with *args, **kwargs - # equivalent to when(session).get(...).thenReturn(resp) + "async text": lambda: "Fake!" }) + .. note:: ``__aenter__``, ``__aexit__``, ``__anext__`` are async by definition, @@ -81,7 +79,7 @@ ... -You can also just mark a function async:: +You can also just mark a function async using the Ellipsis:: session = mock({ "__aenter__": ..., diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mockito-python-2.0.3/docs/the-functions.rst new/mockito-python-2.0.4/docs/the-functions.rst --- old/mockito-python-2.0.3/docs/the-functions.rst 2026-03-13 12:23:42.000000000 +0100 +++ new/mockito-python-2.0.4/docs/the-functions.rst 2026-04-15 11:19:19.000000000 +0200 @@ -4,19 +4,22 @@ The functions ============= -Stable entrypoints are: :func:`when`, :func:`mock`, :func:`unstub`, :func:`verify`, :func:`spy`. New function introduced in v1 are: :func:`when2`, :func:`expect`, :func:`verifyExpectedInteractions`, :func:`verifyStubbedInvocationsAreUsed`, :func:`patch`, :func:`patch_attr`, :func:`patch_dict` +Stable entrypoints are: :func:`when`, :func:`expect`, :func:`mock`, :func:`unstub`, +:func:`verify`, :func:`spy`. +New function introduced in v1 are: :func:`when2`, :func:`verifyExpectedInteractions`, :func:`verifyStubbedInvocationsAreUsed`, :func:`patch`. +New function introduced in v2 are: :func:`patch_attr`, :func:`patch_dict` .. autofunction:: when -.. autofunction:: when2 +.. autofunction:: expect +.. autofunction:: mock .. autofunction:: patch .. autofunction:: patch_attr .. autofunction:: patch_dict -.. autofunction:: expect -.. autofunction:: mock .. autofunction:: unstub .. autofunction:: forget_invocations .. autofunction:: spy .. autofunction:: spy2 +.. autofunction:: when2 This looks like a plethora of verification functions, and especially since you often don't need to `verify` at all. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mockito-python-2.0.3/mockito/invocation.py new/mockito-python-2.0.4/mockito/invocation.py --- old/mockito-python-2.0.3/mockito/invocation.py 2026-03-13 12:23:42.000000000 +0100 +++ new/mockito-python-2.0.4/mockito/invocation.py 2026-04-15 11:19:19.000000000 +0200 @@ -715,9 +715,23 @@ self.verification.verify(self, self.used) def check_used(self) -> None: - if not self.allow_zero_invocations and self.used < len(self.answers): + if self.allow_zero_invocations: + return + + expected_uses = len(self.answers) + if self.used >= expected_uses: + return + + if self.used == 0: raise verificationModule.VerificationError( - "\nUnused stub: %s" % self) + "\nUnused stub: %s" % self + ) + else: + raise verificationModule.VerificationError( + "\nOnly %s of %s answers were used for %s" + % (self.used, expected_uses, self) + ) + class StubbedPropertyAccess(StubbedInvocation): def ensure_mocked_object_has_attribute(self, method_name: str) -> None: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mockito-python-2.0.3/tests/instancemethods_test.py new/mockito-python-2.0.4/tests/instancemethods_test.py --- old/mockito-python-2.0.3/tests/instancemethods_test.py 2026-03-13 12:23:42.000000000 +0100 +++ new/mockito-python-2.0.4/tests/instancemethods_test.py 2026-04-15 11:19:19.000000000 +0200 @@ -362,9 +362,31 @@ when(Dog).bark('Miau').thenReturn('Yep').thenReturn('Nop') rex = Dog() rex.bark('Miau') - with pytest.raises(VerificationError): + with pytest.raises(VerificationError) as exc: verifyStubbedInvocationsAreUsed(Dog) + assert str(exc.value) == ( + "\nOnly 1 of 2 answers were used for bark('Miau')" + ) + + def testFailOnlyTwoOfThreeAnswersUsed(self): + ( + when(Dog) + .bark('Miau') + .thenReturn('Yep') + .thenReturn('Nop') + .thenReturn('Nope') + ) + rex = Dog() + rex.bark('Miau') + rex.bark('Miau') + with pytest.raises(VerificationError) as exc: + verifyStubbedInvocationsAreUsed(Dog) + + assert str(exc.value) == ( + "\nOnly 2 of 3 answers were used for bark('Miau')" + ) + @pytest.mark.usefixtures('unstub') class TestImplicitVerificationsUsingExpect:
