Hello community,
here is the log from the commit of package python-testfixtures for
openSUSE:Factory checked in at 2018-01-06 18:50:58
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-testfixtures (Old)
and /work/SRC/openSUSE:Factory/.python-testfixtures.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-testfixtures"
Sat Jan 6 18:50:58 2018 rev:2 rq:561827 version:5.3.1
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-testfixtures/python-testfixtures.changes
2017-12-14 10:57:31.307503126 +0100
+++
/work/SRC/openSUSE:Factory/.python-testfixtures.new/python-testfixtures.changes
2018-01-06 18:51:09.793697586 +0100
@@ -1,0 +2,21 @@
+Fri Jan 5 09:58:02 UTC 2018 - [email protected]
+
+- Update to version 5.3.1
+ * Fix missing support for the start_new_session parameter to
+ ~testfixtures.popen.MockPopen.
+
+-------------------------------------------------------------------
+Fri Nov 17 10:49:24 UTC 2017 - [email protected]
+
+- Update to version 5.3.0
+ * Add pytest traceback hiding for TempDirectory.compare.
+ * Add warnings that log_capture, tempdir and replace are not
+ currently compatible with pytest's fixtures mechanism.
+ * Better support for stdout or stderr *not* being set to PIPE
+ when using testfixtures.popen.MockPopen.
+ * Add support to testfixtures.popen.MockPopen for
+ using subprocess.Popen as a context manager in Python 3.
+ * Add support to testfixtures.popen.MockPopen for stderr=STDOUT.
+ * Work done on testfixtures.popen.MockPopen.
+
+-------------------------------------------------------------------
Old:
----
testfixtures-5.2.0.tar.gz
New:
----
testfixtures-5.3.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-testfixtures.spec ++++++
--- /var/tmp/diff_new_pack.6laNhP/_old 2018-01-06 18:51:12.537569379 +0100
+++ /var/tmp/diff_new_pack.6laNhP/_new 2018-01-06 18:51:12.541569192 +0100
@@ -1,7 +1,7 @@
#
# spec file for package python-testfixtures
#
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -13,6 +13,7 @@
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
+#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
@@ -21,35 +22,35 @@
%bcond_with test
Name: python-testfixtures
-Version: 5.2.0
+Version: 5.3.1
Release: 0
-License: MIT
Summary: A collection of helpers and mock objects for unit tests and
doc tests
-Url: https://github.com/Simplistix/testfixtures
+License: MIT
Group: Development/Languages/Python
+Url: https://github.com/Simplistix/testfixtures
Source:
https://files.pythonhosted.org/packages/source/t/testfixtures/testfixtures-%{version}.tar.gz
-BuildRequires: python-rpm-macros
BuildRequires: %{python_module devel}
-BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module pkginfo}
BuildRequires: %{python_module setuptools-git}
-BuildRequires: %{python_module wheel}
+BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module twine}
+BuildRequires: %{python_module wheel}
BuildRequires: fdupes
+BuildRequires: python-rpm-macros
%if %{with test}
BuildRequires: %{python_module Sphinx}
-BuildRequires: %{python_module virtualenv}
-BuildRequires: %{python_module pyOpenSSL}
-BuildRequires: %{python_module pytest}
-BuildRequires: %{python_module mock}
-BuildRequires: %{python_module sybil}
BuildRequires: %{python_module coverage}
BuildRequires: %{python_module coveralls}
-BuildRequires: %{python_module zope.component}
-BuildRequires: %{python_module django}
BuildRequires: %{python_module django-core}
BuildRequires: %{python_module django-nose}
+BuildRequires: %{python_module django}
+BuildRequires: %{python_module mock}
+BuildRequires: %{python_module pyOpenSSL}
BuildRequires: %{python_module pytest-django}
+BuildRequires: %{python_module pytest}
+BuildRequires: %{python_module sybil}
+BuildRequires: %{python_module virtualenv}
+BuildRequires: %{python_module zope.component}
%endif
BuildArch: noarch
++++++ testfixtures-5.2.0.tar.gz -> testfixtures-5.3.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/testfixtures-5.2.0/.travis.yml
new/testfixtures-5.3.1/.travis.yml
--- old/testfixtures-5.2.0/.travis.yml 2017-09-03 23:33:10.000000000 +0200
+++ new/testfixtures-5.3.1/.travis.yml 2017-11-21 09:26:48.000000000 +0100
@@ -31,6 +31,7 @@
include:
- stage: coverage
+ if: type != cron
python: 3.6
env: DJANGO_VERSION=latest
after_success: skip
@@ -39,11 +40,16 @@
script: "coveralls-check $TRAVIS_COMMIT"
- stage: release
+ if: tag IS present
python: 3.6
env: DJANGO_VERSION=latest
script: skip
+ # work around https://github.com/travis-ci/travis-ci/issues/8337:
+ after_success: true
- install: "pip install -Ue .[build]"
+ install:
+ - "pip install --upgrade pip setuptools"
+ - "pip install -Ue .[build]"
deploy:
provider: pypi
user: chrisw
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/testfixtures-5.2.0/PKG-INFO
new/testfixtures-5.3.1/PKG-INFO
--- old/testfixtures-5.2.0/PKG-INFO 2017-09-03 23:33:51.000000000 +0200
+++ new/testfixtures-5.3.1/PKG-INFO 2017-11-21 09:27:22.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: testfixtures
-Version: 5.2.0
+Version: 5.3.1
Summary: A collection of helpers and mock objects for unit tests and doc tests.
Home-page: https://github.com/Simplistix/testfixtures
Author: Chris Withers
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/testfixtures-5.2.0/docs/changes.txt
new/testfixtures-5.3.1/docs/changes.txt
--- old/testfixtures-5.2.0/docs/changes.txt 2017-09-03 23:33:10.000000000
+0200
+++ new/testfixtures-5.3.1/docs/changes.txt 2017-11-21 09:26:48.000000000
+0100
@@ -3,6 +3,31 @@
.. currentmodule:: testfixtures
+5.3.1 (21 November 2017)
+------------------------
+
+- Fix missing support for the `start_new_session` parameter to
+ :class:`~testfixtures.popen.MockPopen`.
+
+5.3.0 (28 October 2017)
+-----------------------
+
+- Add pytest traceback hiding for :meth:`TempDirectory.compare`.
+
+- Add warnings that :func:`log_capture`, :func:`tempdir` and
+ :func:`replace` are not currently compatible with pytest's fixtures
+ mechanism.
+
+- Better support for ``stdout`` or ``stderr`` *not* being set to ``PIPE``
+ when using :class:`~testfixtures.popen.MockPopen`.
+
+- Add support to :class:`~testfixtures.popen.MockPopen` for
+ using :class:`subprocess.Popen` as a context manager in Python 3.
+
+- Add support to :class:`~testfixtures.popen.MockPopen` for ``stderr=STDOUT``.
+
+Thanks to Tim Davies for his work on :class:`~testfixtures.popen.MockPopen`.
+
5.2.0 (3 September 2017)
------------------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/testfixtures-5.2.0/docs/files.txt
new/testfixtures-5.3.1/docs/files.txt
--- old/testfixtures-5.2.0/docs/files.txt 2017-09-03 23:33:10.000000000
+0200
+++ new/testfixtures-5.3.1/docs/files.txt 2017-11-21 09:26:48.000000000
+0100
@@ -60,15 +60,29 @@
from testfixtures import tempdir, compare
@tempdir()
- def test_function(d):
- d.write('test.txt', b'some foo thing')
- foo2bar(d.path, 'test.txt')
- compare(d.read('test.txt'), b'some bar thing')
+ def test_function(dir):
+ dir.write('test.txt', b'some foo thing')
+ foo2bar(dir.path, 'test.txt')
+ compare(dir.read('test.txt'), b'some bar thing')
.. check the above raises no assertion error:
>>> test_function()
+.. note::
+ This method is not compatible with pytest's fixture discovery stuff.
+ Instead, put a fixture such as the following in your `conftest.py`:
+
+ .. code-block:: python
+
+ from testfixtures import TempDirectory
+ import pytest
+
+ @pytest.fixture()
+ def dir():
+ with TempDirectory() as dir:
+ yield dir
+
Manual usage
~~~~~~~~~~~~
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/testfixtures-5.2.0/docs/logging.txt
new/testfixtures-5.3.1/docs/logging.txt
--- old/testfixtures-5.2.0/docs/logging.txt 2017-09-03 23:33:10.000000000
+0200
+++ new/testfixtures-5.3.1/docs/logging.txt 2017-11-21 09:26:48.000000000
+0100
@@ -77,20 +77,35 @@
from testfixtures import log_capture
@log_capture()
- def test_function(l):
+ def test_function(capture):
logger = logging.getLogger()
logger.info('a message')
logger.error('an error')
- l.check(
+ capture.check(
('root', 'INFO', 'a message'),
('root', 'ERROR', 'an error'),
- )
+ )
.. check the above raises no assertion error:
>>> test_function()
+
+.. note::
+ This method is not compatible with pytest's fixture discovery stuff.
+ Instead, put a fixture such as the following in your `conftest.py`:
+
+ .. code-block:: python
+
+ import pytest
+
+ @pytest.fixture(autouse=True)
+ def capture():
+ with LogCapture() as capture:
+ yield capture
+
+
Manual usage
~~~~~~~~~~~~
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/testfixtures-5.2.0/docs/mocking.txt
new/testfixtures-5.3.1/docs/mocking.txt
--- old/testfixtures-5.2.0/docs/mocking.txt 2017-09-03 23:33:10.000000000
+0200
+++ new/testfixtures-5.3.1/docs/mocking.txt 2017-11-21 09:26:48.000000000
+0100
@@ -107,19 +107,34 @@
.. code-block:: python
from mock import Mock, call
- from testfixtures import compare,replace
+ from testfixtures import compare, replace
@replace('testfixtures.tests.sample1.X.y', Mock())
- def test_function(mock_y):
- mock_y.return_value = 'mock y'
+ def test_function(mocked_y):
+ mocked_y.return_value = 'mock y'
print(X().y())
- compare(mock_y.mock_calls, expected=[call()])
+ compare(mocked_y.mock_calls, expected=[call()])
The above still results in the same output:
>>> test_function()
mock y
+.. note::
+ This method is not compatible with pytest's fixture discovery stuff.
+ Instead, put a fixture such as the following in your `conftest.py`:
+
+ .. code-block:: python
+
+ from testfixtures import Replace
+ import pytest
+
+ @pytest.fixture()
+ def mocked_y():
+ m = Mock()
+ with Replace('testfixtures.tests.sample1.X.y', m):
+ yield m
+
Manual usage
~~~~~~~~~~~~
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/testfixtures-5.2.0/docs/popen.txt
new/testfixtures-5.3.1/docs/popen.txt
--- old/testfixtures-5.2.0/docs/popen.txt 2017-09-03 23:33:10.000000000
+0200
+++ new/testfixtures-5.3.1/docs/popen.txt 2017-11-21 09:26:48.000000000
+0100
@@ -24,7 +24,7 @@
is an attempt to provide just such a mock.
.. note:: To use :class:`~testfixtures.popen.MockPopen`, you must have the
- :mod:`mock` package installed.
+ :mod:`mock` package installed or be using Python 3.3 or later.
Example usage
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/testfixtures-5.2.0/setup.cfg
new/testfixtures-5.3.1/setup.cfg
--- old/testfixtures-5.2.0/setup.cfg 2017-09-03 23:33:51.000000000 +0200
+++ new/testfixtures-5.3.1/setup.cfg 2017-11-21 09:27:22.000000000 +0100
@@ -2,7 +2,6 @@
universal = 1
[tool:pytest]
-python_classes = NoThanks
norecursedirs = _build
django_settings_module = testfixtures.tests.test_django.settings
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/testfixtures-5.2.0/testfixtures/compat.py
new/testfixtures-5.3.1/testfixtures/compat.py
--- old/testfixtures-5.2.0/testfixtures/compat.py 2017-09-03
23:33:10.000000000 +0200
+++ new/testfixtures-5.3.1/testfixtures/compat.py 2017-11-21
09:26:48.000000000 +0100
@@ -23,6 +23,7 @@
self_name = '__self__'
from io import StringIO
xrange = range
+ from itertools import zip_longest
else:
@@ -42,6 +43,7 @@
self_name = 'im_self'
from StringIO import StringIO
xrange = xrange
+ from itertools import izip_longest as zip_longest
try:
from mock import call as mock_call
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/testfixtures-5.2.0/testfixtures/popen.py
new/testfixtures-5.3.1/testfixtures/popen.py
--- old/testfixtures-5.2.0/testfixtures/popen.py 2017-09-03
23:33:10.000000000 +0200
+++ new/testfixtures-5.3.1/testfixtures/popen.py 2017-11-21
09:26:48.000000000 +0100
@@ -1,11 +1,16 @@
# Copyright (c) 2015 Simplistix Ltd
# See license.txt for license details.
-from mock import Mock
-from subprocess import Popen as Popen
+from itertools import chain
+from subprocess import Popen as Popen, STDOUT, PIPE
from tempfile import TemporaryFile
-from testfixtures.compat import basestring
+from testfixtures.compat import basestring, PY3, zip_longest
from testfixtures.utils import extend_docstring
+try:
+ from unittest.mock import Mock
+except ImportError:
+ from mock import Mock
+
class MockPopen(object):
"""
@@ -29,6 +34,17 @@
inst.terminate.side_effect = self.terminate
inst.kill.side_effect = self.kill
inst.poll.side_effect = self.poll
+ if PY3:
+ def __enter__(self):
+ return inst
+ inst.__enter__ = __enter__
+
+ def __exit__(self, exc_type, exc_val, exc_tb):
+ inst.wait()
+ for stream in inst.stdout, inst.stderr:
+ stream.close()
+
+ inst.__exit__ = __exit__
def set_command(self, command, stdout=b'', stderr=b'', returncode=0,
pid=1234, poll_count=3):
@@ -56,7 +72,8 @@
stdin=None, stdout=None, stderr=None,
preexec_fn=None, close_fds=False, shell=False, cwd=None,
env=None, universal_newlines=False,
- startupinfo=None, creationflags=0):
+ startupinfo=None, creationflags=0, restore_signals=True,
+ start_new_session=False, pass_fds=(), encoding=None,
errors=None):
if isinstance(args, basestring):
cmd = args
@@ -67,14 +84,28 @@
if behaviour is None:
raise KeyError('Nothing specified for command %r' % cmd)
- self.stdout, self.stderr, self.returncode, pid, poll = behaviour
+ stdout_value, stderr_value, self.returncode, pid, poll = behaviour
+
+ if stderr == STDOUT:
+ line_iterator = chain.from_iterable(zip_longest(
+ stdout_value.splitlines(True),
+ stderr_value.splitlines(True)
+ ))
+ stdout_value = b''.join(l for l in line_iterator if l)
+ stderr_value = None
+
self.poll_count = poll
- for name in 'stdout', 'stderr':
- f = TemporaryFile()
- f.write(getattr(self, name))
- f.flush()
- f.seek(0)
- setattr(self.mock.Popen_instance, name, f)
+ for name, option, mock_value in (
+ ('stdout', stdout, stdout_value),
+ ('stderr', stderr, stderr_value)
+ ):
+ value = None
+ if option is PIPE:
+ value = TemporaryFile()
+ value.write(mock_value)
+ value.flush()
+ value.seek(0)
+ setattr(self.mock.Popen_instance, name, value)
self.mock.Popen_instance.pid = pid
self.mock.Popen_instance.returncode = None
@@ -89,7 +120,9 @@
def communicate(self, input=None):
"Simulate calls to :meth:`subprocess.Popen.communicate`"
self.wait()
- return self.stdout, self.stderr
+ i = self.mock.Popen_instance
+ return (i.stdout and i.stdout.read(),
+ i.stderr and i.stderr.read())
def poll(self):
"Simulate calls to :meth:`subprocess.Popen.poll`"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/testfixtures-5.2.0/testfixtures/tempdirectory.py
new/testfixtures-5.3.1/testfixtures/tempdirectory.py
--- old/testfixtures-5.2.0/testfixtures/tempdirectory.py 2017-09-03
23:33:10.000000000 +0200
+++ new/testfixtures-5.3.1/testfixtures/tempdirectory.py 2017-11-21
09:26:48.000000000 +0100
@@ -193,6 +193,9 @@
will be followed when recursively building up
the actual list of directory contents.
"""
+
+ __tracebackhide__ = True
+
compare(expected=sorted(expected),
actual=tuple(self.actual(
path, recursive, files_only, followlinks
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/testfixtures-5.2.0/testfixtures/tests/mock.py
new/testfixtures-5.3.1/testfixtures/tests/mock.py
--- old/testfixtures-5.2.0/testfixtures/tests/mock.py 1970-01-01
01:00:00.000000000 +0100
+++ new/testfixtures-5.3.1/testfixtures/tests/mock.py 2017-11-21
09:26:48.000000000 +0100
@@ -0,0 +1,6 @@
+from __future__ import absolute_import
+
+try:
+ from unittest.mock import Mock, call
+except:
+ from mock import Mock, call
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/testfixtures-5.2.0/testfixtures/tests/test_compare.py
new/testfixtures-5.3.1/testfixtures/tests/test_compare.py
--- old/testfixtures-5.2.0/testfixtures/tests/test_compare.py 2017-09-03
23:33:10.000000000 +0200
+++ new/testfixtures-5.3.1/testfixtures/tests/test_compare.py 2017-11-21
09:26:48.000000000 +0100
@@ -3,7 +3,7 @@
from functools import partial
from collections import namedtuple
-from mock import Mock, call
+from .mock import Mock, call
from re import compile
from testfixtures import (
Comparison as C,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/testfixtures-5.2.0/testfixtures/tests/test_components.py
new/testfixtures-5.3.1/testfixtures/tests/test_components.py
--- old/testfixtures-5.2.0/testfixtures/tests/test_components.py
2017-09-03 23:33:10.000000000 +0200
+++ new/testfixtures-5.3.1/testfixtures/tests/test_components.py
2017-11-21 09:26:48.000000000 +0100
@@ -1,4 +1,4 @@
-from mock import Mock, call
+from .mock import Mock, call
from testfixtures import Replacer, compare
from testfixtures.components import TestComponents
from unittest import TestCase
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/testfixtures-5.2.0/testfixtures/tests/test_logcapture.py
new/testfixtures-5.3.1/testfixtures/tests/test_logcapture.py
--- old/testfixtures-5.2.0/testfixtures/tests/test_logcapture.py
2017-09-03 23:33:10.000000000 +0200
+++ new/testfixtures-5.3.1/testfixtures/tests/test_logcapture.py
2017-11-21 09:26:48.000000000 +0100
@@ -3,7 +3,7 @@
from unittest import TestCase
from warnings import catch_warnings
-from mock import Mock
+from .mock import Mock
from testfixtures import Replacer, LogCapture, compare
@@ -206,7 +206,7 @@
def test_atexit(self):
# http://bugs.python.org/issue25532
- from mock import call
+ from .mock import call
m = Mock()
with Replacer() as r:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/testfixtures-5.2.0/testfixtures/tests/test_popen.py
new/testfixtures-5.3.1/testfixtures/tests/test_popen.py
--- old/testfixtures-5.2.0/testfixtures/tests/test_popen.py 2017-09-03
23:33:10.000000000 +0200
+++ new/testfixtures-5.3.1/testfixtures/tests/test_popen.py 2017-11-21
09:26:48.000000000 +0100
@@ -1,7 +1,7 @@
-from subprocess import PIPE
+from subprocess import PIPE, STDOUT
from unittest import TestCase
-from mock import call
+from .mock import call
from testfixtures import ShouldRaise, compare
from testfixtures.popen import MockPopen
@@ -106,6 +106,37 @@
call.Popen('a command', shell=True, stderr=-1, stdout=-1),
], Popen.mock.method_calls)
+ def
test_read_from_stdout_with_stderr_redirected_check_stdout_contents(self):
+ # setup
+ Popen = MockPopen()
+ Popen.set_command('a command', stdout=b'foo', stderr=b'bar')
+ # usage
+ process = Popen('a command', stdout=PIPE, stderr=STDOUT, shell=True)
+ # test stdout contents
+ compare(b'foobar', process.stdout.read())
+ compare(process.stderr, None)
+
+ def
test_read_from_stdout_with_stderr_redirected_check_stdout_stderr_interleaved(self):
+ # setup
+ Popen = MockPopen()
+ Popen.set_command('a command', stdout=b'o1\no2\no3\no4\n',
stderr=b'e1\ne2\n')
+ # usage
+ process = Popen('a command', stdout=PIPE, stderr=STDOUT, shell=True)
+ self.assertTrue(isinstance(process.stdout.fileno(), int))
+ # test stdout contents
+ compare(b'o1\ne1\no2\ne2\no3\no4\n', process.stdout.read())
+
+ def test_communicate_with_stderr_redirected_check_stderr_is_none(self):
+ # setup
+ Popen = MockPopen()
+ Popen.set_command('a command', stdout=b'foo', stderr=b'bar')
+ # usage
+ process = Popen('a command', stdout=PIPE, stderr=STDOUT, shell=True)
+ out, err = process.communicate()
+ # test stderr is None
+ compare(out, b'foobar')
+ compare(err, None)
+
def test_read_from_stdout_and_stderr(self):
# setup
Popen = MockPopen()
@@ -393,3 +424,70 @@
text = 'poll() takes 1 positional argument but 2 were given'
with ShouldRaise(TypeError(text)):
process.poll('moo')
+
+ def test_non_pipe(self):
+ # setup
+ Popen = MockPopen()
+ Popen.set_command('a command')
+ # usage
+ process = Popen('a command')
+ # checks
+ compare(process.stdout, expected=None)
+ compare(process.stderr, expected=None)
+ out, err = process.communicate()
+ # test the rest
+ compare(out, expected=None)
+ compare(err, expected=None)
+ # test call list
+ compare([
+ call.Popen('a command'),
+ call.Popen_instance.communicate(),
+ ], Popen.mock.method_calls)
+
+ def test_use_as_context_manager(self):
+ # setup
+ Popen = MockPopen()
+ Popen.set_command('a command')
+ if PY2:
+
+ process = Popen('a command')
+ with ShouldRaise(AttributeError):
+ process.__enter__
+ with ShouldRaise(AttributeError):
+ process.__exit__
+
+ else:
+
+ # usage
+ with Popen('a command', stdout=PIPE, stderr=PIPE) as process:
+ # process started, no return code
+ compare(process.pid, 1234)
+ compare(None, process.returncode)
+
+ out, err = process.communicate()
+
+ # test the rest
+ compare(out, b'')
+ compare(err, b'')
+ compare(process.returncode, 0)
+
+ compare(process.stdout.closed, expected=True)
+ compare(process.stderr.closed, expected=True)
+
+ # test call list
+ compare([
+ call.Popen('a command', stderr=-1, stdout=-1),
+ call.Popen_instance.communicate(),
+ call.Popen_instance.wait(),
+ ], Popen.mock.method_calls)
+
+ def test_start_new_session(self):
+ # setup
+ Popen = MockPopen()
+ Popen.set_command('a command')
+ # usage
+ Popen('a command', start_new_session=True)
+ # test call list
+ compare([
+ call.Popen('a command', start_new_session=True),
+ ], Popen.mock.method_calls)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/testfixtures-5.2.0/testfixtures/tests/test_popen_docs.py
new/testfixtures-5.3.1/testfixtures/tests/test_popen_docs.py
--- old/testfixtures-5.2.0/testfixtures/tests/test_popen_docs.py
2017-09-03 23:33:10.000000000 +0200
+++ new/testfixtures-5.3.1/testfixtures/tests/test_popen_docs.py
2017-11-21 09:26:48.000000000 +0100
@@ -15,7 +15,7 @@
from unittest import TestCase
-from mock import call
+from .mock import call
from testfixtures import Replacer, ShouldRaise, compare
from testfixtures.popen import MockPopen
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/testfixtures-5.2.0/testfixtures/tests/test_replace.py
new/testfixtures-5.3.1/testfixtures/tests/test_replace.py
--- old/testfixtures-5.2.0/testfixtures/tests/test_replace.py 2017-09-03
23:33:10.000000000 +0200
+++ new/testfixtures-5.3.1/testfixtures/tests/test_replace.py 2017-11-21
09:26:48.000000000 +0100
@@ -1,4 +1,4 @@
-from mock import Mock
+from .mock import Mock
from testfixtures import (
Replacer,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/testfixtures-5.2.0/testfixtures/tests/test_sybil.py
new/testfixtures-5.3.1/testfixtures/tests/test_sybil.py
--- old/testfixtures-5.2.0/testfixtures/tests/test_sybil.py 2017-09-03
23:33:10.000000000 +0200
+++ new/testfixtures-5.3.1/testfixtures/tests/test_sybil.py 2017-11-21
09:26:48.000000000 +0100
@@ -1,7 +1,7 @@
from textwrap import dedent
from unittest import TestCase
-from mock import Mock
+from .mock import Mock
from sybil.document import Document
from testfixtures import compare, Comparison as C, TempDirectory
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/testfixtures-5.2.0/testfixtures/tests/test_tempdir.py
new/testfixtures-5.3.1/testfixtures/tests/test_tempdir.py
--- old/testfixtures-5.2.0/testfixtures/tests/test_tempdir.py 2017-09-03
23:33:10.000000000 +0200
+++ new/testfixtures-5.3.1/testfixtures/tests/test_tempdir.py 2017-11-21
09:26:48.000000000 +0100
@@ -1,6 +1,6 @@
import os
-from mock import Mock
+from .mock import Mock
from tempfile import mkdtemp
from testfixtures import Replacer, ShouldRaise, TempDirectory, compare, tempdir
from unittest import TestCase
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/testfixtures-5.2.0/testfixtures/tests/test_tempdirectory.py
new/testfixtures-5.3.1/testfixtures/tests/test_tempdirectory.py
--- old/testfixtures-5.2.0/testfixtures/tests/test_tempdirectory.py
2017-09-03 23:33:10.000000000 +0200
+++ new/testfixtures-5.3.1/testfixtures/tests/test_tempdirectory.py
2017-11-21 09:26:48.000000000 +0100
@@ -3,7 +3,7 @@
from unittest import TestCase
from warnings import catch_warnings
-from mock import Mock
+from .mock import Mock
from testfixtures import (
TempDirectory, Replacer, ShouldRaise, compare, OutputCapture
@@ -202,7 +202,7 @@
def test_atexit(self):
# http://bugs.python.org/issue25532
- from mock import call
+ from .mock import call
m = Mock()
with Replacer() as r:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/testfixtures-5.2.0/testfixtures/tests/test_wrap.py
new/testfixtures-5.3.1/testfixtures/tests/test_wrap.py
--- old/testfixtures-5.2.0/testfixtures/tests/test_wrap.py 2017-09-03
23:33:10.000000000 +0200
+++ new/testfixtures-5.3.1/testfixtures/tests/test_wrap.py 2017-11-21
09:26:48.000000000 +0100
@@ -1,6 +1,6 @@
from unittest import TestCase
-from mock import Mock
+from .mock import Mock
from testfixtures import wrap, compare
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/testfixtures-5.2.0/testfixtures/version.txt
new/testfixtures-5.3.1/testfixtures/version.txt
--- old/testfixtures-5.2.0/testfixtures/version.txt 2017-09-03
23:33:10.000000000 +0200
+++ new/testfixtures-5.3.1/testfixtures/version.txt 2017-11-21
09:26:48.000000000 +0100
@@ -1 +1 @@
-5.2.0
+5.3.1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/testfixtures-5.2.0/testfixtures.egg-info/PKG-INFO
new/testfixtures-5.3.1/testfixtures.egg-info/PKG-INFO
--- old/testfixtures-5.2.0/testfixtures.egg-info/PKG-INFO 2017-09-03
23:33:51.000000000 +0200
+++ new/testfixtures-5.3.1/testfixtures.egg-info/PKG-INFO 2017-11-21
09:27:22.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: testfixtures
-Version: 5.2.0
+Version: 5.3.1
Summary: A collection of helpers and mock objects for unit tests and doc tests.
Home-page: https://github.com/Simplistix/testfixtures
Author: Chris Withers
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/testfixtures-5.2.0/testfixtures.egg-info/SOURCES.txt
new/testfixtures-5.3.1/testfixtures.egg-info/SOURCES.txt
--- old/testfixtures-5.2.0/testfixtures.egg-info/SOURCES.txt 2017-09-03
23:33:51.000000000 +0200
+++ new/testfixtures-5.3.1/testfixtures.egg-info/SOURCES.txt 2017-11-21
09:27:22.000000000 +0100
@@ -58,6 +58,7 @@
testfixtures/tests/configparser-write.txt
testfixtures/tests/conftest.py
testfixtures/tests/directory-contents.txt
+testfixtures/tests/mock.py
testfixtures/tests/sample1.py
testfixtures/tests/sample2.py
testfixtures/tests/test_compare.py