summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorRobert Collins <rbtcollins@hp.com>2015-07-23 15:48:20 (GMT)
committerRobert Collins <rbtcollins@hp.com>2015-07-23 15:48:20 (GMT)
commitca647ef60aa74e3dea81a399ded20c648a69e742 (patch)
tree041db4c6d33f51e0965162ae4521838c8cf469dc /Doc
parent80e4f30e64e2e5f8506f8342f6fca63eab20a4ab (diff)
downloadcpython-ca647ef60aa74e3dea81a399ded20c648a69e742.zip
cpython-ca647ef60aa74e3dea81a399ded20c648a69e742.tar.gz
cpython-ca647ef60aa74e3dea81a399ded20c648a69e742.tar.bz2
Issue #21750: Further fixup to be styled like other mock APIs.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/unittest.mock.rst8
1 files changed, 5 insertions, 3 deletions
diff --git a/Doc/library/unittest.mock.rst b/Doc/library/unittest.mock.rst
index 8346cb9..fcd7727 100644
--- a/Doc/library/unittest.mock.rst
+++ b/Doc/library/unittest.mock.rst
@@ -1995,9 +1995,11 @@ mock_open
:meth:`~io.IOBase.readline`, and :meth:`~io.IOBase.readlines` methods
of the file handle to return. Calls to those methods will take data from
*read_data* until it is depleted. The mock of these methods is pretty
- simplistic. If you need more control over the data that you are feeding to
- the tested code you will need to customize this mock for yourself.
- *read_data* is an empty string by default.
+ simplistic: every time the *mock* is called, the *read_data* is rewound to
+ the start. If you need more control over the data that you are feeding to
+ the tested code you will need to customize this mock for yourself. When that
+ is insufficient, one of the in-memory filesystem packages on `PyPI
+ <https://pypi.python.org/pypi>`_ can offer a realistic filesystem for testing.
Using :func:`open` as a context manager is a great way to ensure your file handles
are closed properly and is becoming common::