Hello community,

here is the log from the commit of package python-testfixtures for 
openSUSE:Factory checked in at 2019-06-18 14:57:59
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-testfixtures (Old)
 and      /work/SRC/openSUSE:Factory/.python-testfixtures.new.4811 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-testfixtures"

Tue Jun 18 14:57:59 2019 rev:9 rq:710324 version:6.9.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-testfixtures/python-testfixtures.changes  
2019-05-22 11:15:33.594539011 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-testfixtures.new.4811/python-testfixtures.changes
        2019-06-18 14:58:11.533336496 +0200
@@ -1,0 +2,13 @@
+Mon Jun 17 10:12:42 UTC 2019 - [email protected]
+
+- version update to 6.9.0
+  - Fix deprecation warning relating to :func:`getargspec`.
+  - Improve :doc:`mocking <mocking>` docs.
+  - Add ``strip_whitespace`` option to :class:`OutputCapture`.
+  - When ``separate`` is used with :class:`OutputCapture`, differences in 
``stdout` and ``stderr``
+    are now given in the same :class:`AssertionError`.
+  - :class:`ShouldRaise` no longer catches exceptions that are not of the 
required type.
+  - Fixed a problem that resulted in unhelpful :func:`compare` failures when
+    :func:`~unittest.mock.call` was involved and Python 3.6.7 was used.
+
+-------------------------------------------------------------------

Old:
----
  testfixtures-6.8.2.tar.gz

New:
----
  testfixtures-6.9.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-testfixtures.spec ++++++
--- /var/tmp/diff_new_pack.CCLKQ3/_old  2019-06-18 14:58:12.153336140 +0200
+++ /var/tmp/diff_new_pack.CCLKQ3/_new  2019-06-18 14:58:12.161336135 +0200
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-testfixtures
-Version:        6.8.2
+Version:        6.9.0
 Release:        0
 Summary:        A collection of helpers and mock objects for unit tests and 
doc tests
 License:        MIT

++++++ testfixtures-6.8.2.tar.gz -> testfixtures-6.9.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/testfixtures-6.8.2/CHANGELOG.rst 
new/testfixtures-6.9.0/CHANGELOG.rst
--- old/testfixtures-6.8.2/CHANGELOG.rst        2019-05-04 14:44:51.000000000 
+0200
+++ new/testfixtures-6.9.0/CHANGELOG.rst        2019-06-10 17:46:54.000000000 
+0200
@@ -3,6 +3,27 @@
 
 .. currentmodule:: testfixtures
 
+6.9.0 (10 Jun 2019)
+-------------------
+
+- Fix deprecation warning relating to :func:`getargspec`.
+
+- Improve :doc:`mocking <mocking>` docs.
+
+- Add ``strip_whitespace`` option to :class:`OutputCapture`.
+
+- When ``separate`` is used with :class:`OutputCapture`, differences in 
``stdout` and ``stderr``
+  are now given in the same :class:`AssertionError`.
+
+- :class:`ShouldRaise` no longer catches exceptions that are not of the 
required type.
+
+- Fixed a problem that resulted in unhelpful :func:`compare` failures when
+  :func:`~unittest.mock.call` was involved and Python 3.6.7 was used.
+
+Thanks to Ɓukasz Rogalski for the deprecation warning fix.
+
+Thanks to Wim Glenn for the :class:`ShouldRaise` idea.
+
 6.8.2 (4 May 2019)
 ------------------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/testfixtures-6.8.2/PKG-INFO 
new/testfixtures-6.9.0/PKG-INFO
--- old/testfixtures-6.8.2/PKG-INFO     2019-05-04 14:44:54.000000000 +0200
+++ new/testfixtures-6.9.0/PKG-INFO     2019-06-10 17:46:57.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: testfixtures
-Version: 6.8.2
+Version: 6.9.0
 Summary: A collection of helpers and mock objects for unit tests and doc tests.
 Home-page: https://github.com/Simplistix/testfixtures
 Author: Chris Withers
@@ -75,6 +75,6 @@
 Classifier: Programming Language :: Python :: 3
 Classifier: Programming Language :: Python :: 3.6
 Classifier: Programming Language :: Python :: 3.7
-Provides-Extra: test
 Provides-Extra: docs
 Provides-Extra: build
+Provides-Extra: test
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/testfixtures-6.8.2/docs/mocking.txt 
new/testfixtures-6.9.0/docs/mocking.txt
--- old/testfixtures-6.8.2/docs/mocking.txt     2019-05-04 14:44:51.000000000 
+0200
+++ new/testfixtures-6.9.0/docs/mocking.txt     2019-06-10 17:46:54.000000000 
+0200
@@ -1,14 +1,19 @@
 Mocking out objects and methods
 ===============================
 
-Mocking is the process of replacing chunks of complex functionality
+.. py:currentmodule:: testfixtures
+
+Mocking is the process of replacing objects used in your code with ones
+that make testing easier, but only while the tests are running.
+
+This may mean replacing resources or dependencies, such as database
+connections or file paths, with ones that are isolated for testing.
+It may also mean replacing chunks of complex functionality
 that aren't the subject of the test with mock objects that allow you
-to check that the mocked out functionality is being used as expected. 
+to check that the mocked out functionality is being used as expected.
 
-In this way, you can break down testing of a complicated set of
-interacting components into testing of each individual component.
-The behaviour of components can then be tested individually, 
-irrespective of the behaviour of the components around it.
+What to mock with
+-----------------
 
 Python has a standard mock implementation in the form of :mod:`unittest.mock`
 which is also available as a `rolling backport`__ so that the latest features
@@ -21,11 +26,22 @@
 to the rolling backport if it is present. The facade also contains any bugfixes
 that are critical to the operation of functionality provided by TestFixtures.
 
+TestFixtures also provides specialised mocks for dealing with
+:doc:`dates and times <datetime>` and :doc:`subprocesses <popen>`.
+
+How to mock
+-----------
+
+TestFixtures provides :class:`Replace`, :class:`Replacer` and the 
:func:`replace`
+decorator to mock out objects. These work in a similar way to
+:func:`unittest.mock.patch`, and have been around longer. They still provide a 
little
+more flexibility than :func:`~unittest.mock.patch`, so you whichever feels 
best in
+your codebase.
 
 Methods of replacement
 ----------------------
 
-TestFixtures provides three different methods of mocking out
+There are three different methods of mocking out
 functionality that can be used to replace functions, classes
 or even individual methods on a class. Consider the following module:
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/testfixtures-6.8.2/testfixtures/mock.py 
new/testfixtures-6.9.0/testfixtures/mock.py
--- old/testfixtures-6.8.2/testfixtures/mock.py 2019-05-04 14:44:51.000000000 
+0200
+++ new/testfixtures-6.9.0/testfixtures/mock.py 2019-06-10 17:46:54.000000000 
+0200
@@ -97,7 +97,7 @@
 
 if (
     (has_backport and backport_version[:3] > (2, 0, 0)) or
-    (3, 6, 7) <= sys.version_info[:3] < (3, 7, 0) or
+    (3, 6, 7) < sys.version_info[:3] < (3, 7, 0) or
     sys.version_info[:3] > (3, 7, 1)
 ):
     parent_name = '_mock_parent'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/testfixtures-6.8.2/testfixtures/outputcapture.py 
new/testfixtures-6.9.0/testfixtures/outputcapture.py
--- old/testfixtures-6.8.2/testfixtures/outputcapture.py        2019-05-04 
14:44:51.000000000 +0200
+++ new/testfixtures-6.9.0/testfixtures/outputcapture.py        2019-06-10 
17:46:54.000000000 +0200
@@ -21,6 +21,10 @@
                to the file descriptors, but is more invasive, so only use it
                when you need it.
 
+    :param strip_whitespace:
+        When ``True``, which is the default, leading and training whitespace
+        is trimmed from both the expected and actual values when comparing.
+
     .. note:: If ``separate`` is passed as ``True``,
               :attr:`OutputCapture.captured` will be an empty string.
     """
@@ -28,9 +32,10 @@
     original_stdout = None
     original_stderr = None
 
-    def __init__(self, separate=False, fd=False):
+    def __init__(self, separate=False, fd=False, strip_whitespace=True):
         self.separate = separate
         self.fd = fd
+        self.strip_whitespace = strip_whitespace
 
     def __enter__(self):
         if self.fd:
@@ -109,11 +114,22 @@
 
         :param stderr: A string containing the expected output to ``stderr``.
         """
+        expected_mapping = {}
+        actual_mapping = {}
         for prefix, _expected, captured in (
-                (None, expected, self.captured),
+                ('captured', expected, self.captured),
                 ('stdout', stdout, self._read(self.stdout)),
                 ('stderr', stderr, self._read(self.stderr)),
         ):
             if self.fd and isinstance(_expected, Unicode):
                 _expected = _expected.encode()
-            compare(_expected.strip(), actual=captured.strip(), prefix=prefix)
+            if self.strip_whitespace:
+                _expected = _expected.strip()
+                captured = captured.strip()
+            if _expected != captured:
+                expected_mapping[prefix] = _expected
+                actual_mapping[prefix] = captured
+        if len(expected_mapping) == 1:
+            compare(expected=tuple(expected_mapping.values())[0],
+                    actual=tuple(actual_mapping.values())[0])
+        compare(expected=expected_mapping, actual=actual_mapping)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/testfixtures-6.8.2/testfixtures/shouldraise.py 
new/testfixtures-6.9.0/testfixtures/shouldraise.py
--- old/testfixtures-6.8.2/testfixtures/shouldraise.py  2019-05-04 
14:44:51.000000000 +0200
+++ new/testfixtures-6.9.0/testfixtures/shouldraise.py  2019-06-10 
17:46:54.000000000 +0200
@@ -1,7 +1,7 @@
 from contextlib import contextmanager
 from functools import wraps
-from testfixtures import Comparison, diff, compare
-from testfixtures.utils import match_type_or_instance
+from testfixtures import diff, compare
+from .compat import ClassType
 
 param_docs = """
 
@@ -42,19 +42,27 @@
     def __enter__(self):
         return self
 
-    def __exit__(self, type, actual, traceback):
+    def __exit__(self, type_, actual, traceback):
         __tracebackhide__ = True
         self.raised = actual
         if self.expected:
             if self.exception:
+                if actual is not None:
+                    if isinstance(self.exception, (ClassType, type)):
+                        actual = type(actual)
+                        if self.exception is not actual:
+                            return False
+                    else:
+                        if type(self.exception) is not type(actual):
+                            return False
                 compare(self.exception,
-                        match_type_or_instance(self.exception, actual),
+                        actual,
                         x_label='expected',
                         y_label='raised')
             elif not actual:
                 raise AssertionError('No exception raised!')
         elif actual:
-            raise AssertionError('%r raised, no exception expected' % actual)
+            return False
         return True
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/testfixtures-6.8.2/testfixtures/tests/test_compare.py 
new/testfixtures-6.9.0/testfixtures/tests/test_compare.py
--- old/testfixtures-6.8.2/testfixtures/tests/test_compare.py   2019-05-04 
14:44:51.000000000 +0200
+++ new/testfixtures-6.9.0/testfixtures/tests/test_compare.py   2019-06-10 
17:46:54.000000000 +0200
@@ -34,6 +34,7 @@
 
 marker = object()
 
+_compare = compare
 
 class CompareHelper(object):
 
@@ -51,7 +52,7 @@
             actual = hexsub(e.args[0])
             if message is not None:
                 # handy for debugging, but can't be relied on for tests!
-                compare(actual, expected=message, show_whitespace=True)
+                _compare(actual, expected=message, show_whitespace=True)
                 assert actual == message
             else:
                 if not regex.match(actual):  # pragma: no cover
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/testfixtures-6.8.2/testfixtures/tests/test_outputcapture.py 
new/testfixtures-6.9.0/testfixtures/tests/test_outputcapture.py
--- old/testfixtures-6.8.2/testfixtures/tests/test_outputcapture.py     
2019-05-04 14:44:51.000000000 +0200
+++ new/testfixtures-6.9.0/testfixtures/tests/test_outputcapture.py     
2019-06-10 17:46:54.000000000 +0200
@@ -5,15 +5,24 @@
 from unittest import TestCase
 
 from testfixtures import OutputCapture, compare
+from .test_compare import CompareHelper
 
-
-class TestOutputCapture(TestCase):
+class TestOutputCapture(CompareHelper, TestCase):
 
     def test_compare_strips(self):
         with OutputCapture() as o:
             print(' Bar! ')
         o.compare('Bar!')
 
+    def test_compare_doesnt_strip(self):
+        with OutputCapture(strip_whitespace=False) as o:
+            print(' Bar! ')
+        self.check_raises(
+            '\tBar!',
+            compare=o.compare,
+            message="'\\tBar!' (expected) != ' Bar! \\n' (actual)",
+        )
+
     def test_stdout_and_stderr(self):
         with OutputCapture() as o:
             print('hello', file=sys.stdout)
@@ -36,6 +45,27 @@
         o.compare(stdout="hello\nthere\n",
                   stderr="out\nnow\n")
 
+    def test_compare_both_at_once(self):
+        with OutputCapture(separate=True) as o:
+            print('hello', file=sys.stdout)
+            print('out', file=sys.stderr)
+        self.check_raises(
+            stdout="out\n",
+            stderr="hello\n",
+            compare=o.compare,
+            message=(
+                'dict not as expected:\n'
+                '\n'
+                'values differ:\n'
+                "'stderr': 'hello' (expected) != 'out' (actual)\n"
+                "'stdout': 'out' (expected) != 'hello' (actual)\n"
+                '\n'
+                "While comparing ['stderr']: 'hello' (expected) != 'out' 
(actual)\n"
+                '\n'
+                "While comparing ['stdout']: 'out' (expected) != 'hello' 
(actual)"
+            ),
+        )
+
     def test_original_restore(self):
         o_out, o_err = sys.stdout, sys.stderr
         with OutputCapture() as o:
@@ -73,7 +103,8 @@
         self.assertTrue(sys.stdout is o_out)
         self.assertTrue(sys.stderr is o_err)
 
-class TestOutputCaptureWithFixtures(object):
+
+class TestOutputCaptureWithDescriptors(object):
 
     def test_fd(self, capfd):
         with capfd.disabled(), OutputCapture(fd=True) as o:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/testfixtures-6.8.2/testfixtures/tests/test_should_raise.py 
new/testfixtures-6.9.0/testfixtures/tests/test_should_raise.py
--- old/testfixtures-6.8.2/testfixtures/tests/test_should_raise.py      
2019-05-04 14:44:51.000000000 +0200
+++ new/testfixtures-6.9.0/testfixtures/tests/test_should_raise.py      
2019-06-10 17:46:54.000000000 +0200
@@ -3,7 +3,7 @@
 from testfixtures import Comparison as C, ShouldRaise, should_raise
 from unittest import TestCase
 
-from ..compat import PY3, PY_36_PLUS, PY_37_PLUS
+from ..compat import PY3, PY_36_PLUS, PY_37_PLUS, PY2
 from ..shouldraise import ShouldAssert
 
 
@@ -67,19 +67,26 @@
         should_raise(ValueError)(to_test)()
 
     def test_wrong_exception_class(self):
+        expected_exception = ValueError('bar')
         def to_test():
-            raise ValueError('bar')
-        if PY_37_PLUS:
-            message = ("<class 'KeyError'> (expected) != "
-                       "ValueError('bar') (raised)")
-        elif PY3:
-            message = ("<class 'KeyError'> (expected) != "
-                       "ValueError('bar',) (raised)")
-        else:
-            message = ("<type 'exceptions.KeyError'> (expected) != "
-                       "ValueError('bar',) (raised)")
-        with ShouldAssert(message):
+            raise expected_exception
+        try:
             should_raise(KeyError)(to_test)()
+        except ValueError as actual_exception:
+            assert actual_exception is expected_exception
+        else:  # pragma: no cover
+            self.fail(('Wrong exception raised'))
+
+    def test_wrong_exception_type(self):
+        expected_exception = ValueError('bar')
+        def to_test():
+            raise expected_exception
+        try:
+            should_raise(KeyError('foo'))(to_test)()
+        except ValueError as actual_exception:
+            assert actual_exception is expected_exception
+        else:  # pragma: no cover
+            self.fail(('Wrong exception raised'))
 
     def test_no_supplied_or_raised(self):
         # effectvely we're saying "something should be raised!"
@@ -190,6 +197,15 @@
             with ShouldRaise(ValueError('foo')):
                 pass
 
+    def test_with_no_exception_when_expected_by_type(self):
+        if PY2:
+            expected = "<type 'exceptions.ValueError'> (expected) != None 
(raised)"
+        else:
+            expected = "<class 'ValueError'> (expected) != None (raised)"
+        with ShouldAssert(expected):
+            with ShouldRaise(ValueError):
+                pass
+
     def test_with_no_exception_when_neither_expected(self):
         with ShouldAssert("No exception raised!"):
             with ShouldRaise():
@@ -225,21 +241,6 @@
         with ShouldRaise(FileTypeError('X')):
             raise FileTypeError('X')
 
-    def test_assert_keyerror_raised(self):
-
-        class Dodgy(dict):
-            def __getattr__(self, name):
-                # NB: we forgot to turn our KeyError into an attribute error
-                return self[name]
-
-        if PY_37_PLUS:
-            expected = "AttributeError('foo') (expected) != KeyError('foo') 
(raised)"
-        else:
-            expected = "AttributeError('foo',) (expected) != KeyError('foo',) 
(raised)"
-        with ShouldAssert(expected):
-            with ShouldRaise(AttributeError('foo')):
-                Dodgy().foo
-
     def test_decorator_usage(self):
 
         @should_raise(ValueError('bad'))
@@ -262,13 +263,14 @@
             pass
 
     def test_unless_true_not_okay(self):
-        if PY_37_PLUS:
-            expected = "AttributeError('foo') raised, no exception expected"
-        else:
-            expected = "AttributeError('foo',) raised, no exception expected"
-        with ShouldAssert(expected):
+        expected_exception = AttributeError('foo')
+        try:
             with ShouldRaise(unless=True):
-                raise AttributeError('foo')
+                raise expected_exception
+        except AttributeError as actual_exception:
+            assert actual_exception is expected_exception
+        else:  # pragma: no cover
+            self.fail(('Wrong exception raised'))
 
     def test_unless_decorator_usage(self):
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/testfixtures-6.8.2/testfixtures/utils.py 
new/testfixtures-6.9.0/testfixtures/utils.py
--- old/testfixtures-6.8.2/testfixtures/utils.py        2019-05-04 
14:44:51.000000000 +0200
+++ new/testfixtures-6.9.0/testfixtures/utils.py        2019-06-10 
17:46:54.000000000 +0200
@@ -1,8 +1,12 @@
 import sys
 from functools import wraps
-from inspect import getargspec
 from textwrap import dedent
 
+try:
+    from inspect import getfullargspec as getargspec
+except ImportError:
+    from inspect import getargspec
+
 from . import singleton
 from .compat import ClassType
 
@@ -61,7 +65,7 @@
             extra_args = []
             entered_patchers = []
 
-            to_add = len(getargspec(func)[0][len(args):])
+            to_add = len(getargspec(func).args[len(args):])
             added = 0
 
             exc_info = tuple()
@@ -100,14 +104,6 @@
             pass
 
 
-def match_type_or_instance(expected, actual):
-    if isinstance(expected, (ClassType, type)):
-        type_actual = type(actual)
-        if expected is type_actual:
-            return type_actual
-    return actual
-
-
 def indent(text, indent_size = 2):
     indented = []
     for do_indent, line in enumerate(text.splitlines(True)):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/testfixtures-6.8.2/testfixtures/version.txt 
new/testfixtures-6.9.0/testfixtures/version.txt
--- old/testfixtures-6.8.2/testfixtures/version.txt     2019-05-04 
14:44:51.000000000 +0200
+++ new/testfixtures-6.9.0/testfixtures/version.txt     2019-06-10 
17:46:54.000000000 +0200
@@ -1 +1 @@
-6.8.2
+6.9.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/testfixtures-6.8.2/testfixtures.egg-info/PKG-INFO 
new/testfixtures-6.9.0/testfixtures.egg-info/PKG-INFO
--- old/testfixtures-6.8.2/testfixtures.egg-info/PKG-INFO       2019-05-04 
14:44:54.000000000 +0200
+++ new/testfixtures-6.9.0/testfixtures.egg-info/PKG-INFO       2019-06-10 
17:46:57.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: testfixtures
-Version: 6.8.2
+Version: 6.9.0
 Summary: A collection of helpers and mock objects for unit tests and doc tests.
 Home-page: https://github.com/Simplistix/testfixtures
 Author: Chris Withers
@@ -75,6 +75,6 @@
 Classifier: Programming Language :: Python :: 3
 Classifier: Programming Language :: Python :: 3.6
 Classifier: Programming Language :: Python :: 3.7
-Provides-Extra: test
 Provides-Extra: docs
 Provides-Extra: build
+Provides-Extra: test


Reply via email to