Skip to content

Commit 8308d85

Browse files
authored
Made some changes in relation to the first PyTest conversion sprint (#6548)
* Made some changes in relation to the first PyTest conversion sprint * review comments and corrections
1 parent d4adfce commit 8308d85

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

docs/src/developers_guide/contributing_pytest_conversions.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ Conversion Checklist
4040
...
4141
4242
#. Check for references to ``@tests``. These should be changed to ``@_shared_utils``.
43-
#. Check for references to ``with mock.patch("...")``. These should be replaced with
44-
``mocker.patch("...")``. ``mocker`` is a fixture, and can be passed into functions.
43+
#. Check for references to ``with mock.patch("...")``. These should be replaced with either
44+
``with mocker.patch("...")`` or ``mocker.patch("..."). Note that ``mocker`` is a fixture,
45+
and should be passed into relevant functions as a parameter.
4546
#. Check for ``np.testing.assert...``. This can usually be swapped for
4647
``_shared_utils.assert...``.
4748
#. Check for references to ``super()``. Most test classes used to inherit from
@@ -73,4 +74,6 @@ Common Translations
7374
- ``with pytest.raises(cls, match=msg_re):``
7475
* - ``mock.patch(...)``
7576
- ``mocker.patch(...)``
77+
* - ``with mock.patch.object(...) as x:``
78+
- ``x = mocker.patch.object(...)``
7679

lib/iris/tests/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
.. note:: This module needs to control the matplotlib backend, so it
88
**must** be imported before ``matplotlib.pyplot``.
99
10+
.. note:: Iris is currently undergoing conversion to PyTest. Once that
11+
conversion is complete, this module will eventually be removed.
12+
1013
The primary class for this module is :class:`IrisTest`.
1114
1215
"""

lib/iris/tests/_shared_utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
#
33
# This file is part of Iris and is released under the BSD license.
44
# See LICENSE in the root of the repository for full licensing details.
5-
"""Provides testing capabilities and customisations specific to Iris."""
5+
"""Provides testing capabilities and customisations specific to Iris.
6+
7+
.. note:: This module is private, and is subject to change on short notice.
8+
"""
69

710
import collections
811
from collections.abc import Mapping

0 commit comments

Comments
 (0)