Skip to content

Commit a1aa63a

Browse files
committed
Added test specific Python compatibility notes.
1 parent f5d63f2 commit a1aa63a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

doc/contributing.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,23 @@ between versions.
5757
request if additional work needs to be done to make the code compatible with
5858
all the supported Python releases.
5959

60+
Test specific concerns
61+
''''''''''''''''''''''
62+
63+
The :mod:`unittest` module received a massive upgrade in Python 2.7, including
64+
some very useful new functionality. However, retaining compatibility with older
65+
Python versions is very important, so this new functionality can't be used.
66+
Some specific issues to bear in mind are listed below.
67+
68+
Many assertions, such as :meth:`~unittest.TestCase.assertIn` and
69+
:meth:`~unittest.TestCase.assertGreater`, only exist from 2.7, and can't be used.
70+
The simple workaround is to evaluate an expression to test with
71+
:meth:`~unittest.TestCase.assertTrue`
72+
73+
The incredibly functions for skipping tests(:func:`~unittest.skip`) and marking
74+
expected failures(:func:`~unittest.expectedFailure`) were only added in 2.7, and
75+
unfortunately can't be used.
76+
6077
.. todo::
6178
Add topic branches and pull request usage examples, but most git users are
6279
likely to be comfortable with these already

0 commit comments

Comments
 (0)