Merge https://github.com/testing-cabal/testtools
authorChris Gagnon <robotfuel@robotfuel.com>
Tue, 27 May 2014 16:02:14 +0000 (12:02 -0400)
committerChris Gagnon <robotfuel@robotfuel.com>
Tue, 27 May 2014 16:02:14 +0000 (12:02 -0400)
Conflicts:
NEWS
doc/for-test-authors.rst
testtools/testcase.py
testtools/tests/test_testcase.py

1  2 
NEWS
doc/for-test-authors.rst

diff --cc NEWS
index cd4ff023c4523dfa7acf59ba2eba545a645f2569,a1e35e334f599322dd39f690b626e5201e357f74..177cd9374b97a6542e638fff25a18ab63ce77da2
--- 1/NEWS
--- 2/NEWS
+++ b/NEWS
@@@ -10,15 -10,27 +10,34 @@@ NEX
  Changes
  -------
  
- * Removed a number of code paths where Python 2.4 and Python 2.5 were
-   explicitly handled. (Daniel Watkins)
+ * Make testtools compatible with the ``unittest.expectedFailure`` decorator in
+   Python 3.4. (Thomi Richards)
  
 +Improvements
 +------------
 +
 +* Introduce the assert_that function, which allows matchers to be used
 +  independent of testtools.TestCase. (Daniel Watkins, #1243834)
 +
++
+ 0.9.35
+ ~~~~~~
+ Changes
+ -------
+ * Removed a number of code paths where Python 2.4 and Python 2.5 were
+   explicitly handled. (Daniel Watkins)
+ Improvements
+ ------------
+ * Added the ``testtools.TestCase.expectThat`` method, which implements
+   delayed assertions. (Thomi Richards)
+ * Docs are now built as part of the Travis-CI build, reducing the chance of
+   Read The Docs being broken accidentally. (Daniel Watkins, #1158773)
  0.9.34
  ~~~~~~
  
index ba515b3edcfaf2c6615e4c0e0786c36e9b64543f,d44c086b0949803a7e20678e1f7a5e88af7579a0..10167593689e9d057c7bdb2c866fc2daef30b6d5
@@@ -288,24 -288,43 +288,62 @@@ Which is roughly equivalent to:
        self.assertNotEqual(result, 50)
  
  
 +``assert_that`` Function
 +------------------------
 +
 +In addition to ``self.assertThat``, testtools also provides the ``assert_that``
 +function in ``testtools.assertions`` (which is what ``self.assertThat`` backs
 +on to internally).  This behaves as the method version does::
 +
 +    class TestSquare(TestCase):
 +
 +        def test_square():
 +            result = square(7)
 +            assert_that(result, Equals(49))
 +
 +        def test_square_silly():
 +            result = square(7)
 +            assert_that(result, Not(Equals(50)))
 +
 +
++=======
+ Delayed Assertions
+ ~~~~~~~~~~~~~~~~~~
+ A failure in the ``self.assertThat`` method will immediately fail the test: No
+ more test code will be run after the assertion failure.
+ The ``expectThat`` method behaves the same as ``assertThat`` with one
+ exception: when failing the test it does so at the end of the test code rather
+ than when the mismatch is detected. For example::
+   import subprocess
+   from testtools import TestCase
+   from testtools.matchers import Equals
+   class SomeProcessTests(TestCase):
+       def test_process_output(self):
+           process = subprocess.Popen(
+             ["my-app", "/some/path"],
+             stdout=subprocess.PIPE,
+             stderr=subprocess.PIPE
+           )
+           stdout, stderrr = process.communicate()
+           self.expectThat(process.returncode, Equals(0))
+           self.expectThat(stdout, Equals("Expected Output"))
+           self.expectThat(stderr, Equals(""))
+ In this example, should the ``expectThat`` call fail, the failure will be
+ recorded in the test result, but the test will continue as normal. If all
+ three assertions fail, the test result will have three failures recorded, and
+ the failure details for each failed assertion will be attached to the test
+ result.
  Stock matchers
  --------------