Commit Graph

66 Commits

Author SHA1 Message Date
Ezio Melotti d8b509b192 #13012: use splitlines(keepends=True/False) instead of splitlines(0/1). 2011-09-28 17:37:55 +03:00
Benjamin Peterson 0850638957 merge 3.2 (#12544) 2011-07-12 19:23:43 -05:00
Benjamin Peterson 34b2b263db this can be done without a custom dict (also fixes #12544) 2011-07-12 19:21:42 -05:00
Ezio Melotti b4dc2502ad Issue #10775: assertRaises, assertRaisesRegex, assertWarns, and assertWarnsRegex now accept a keyword argument 'msg' when used as context managers. Initial patch by Winston Ewert. 2011-05-06 15:01:41 +03:00
Ezio Melotti 9490af2150 #11763: merge with 3.2. 2011-04-27 10:21:51 +03:00
Ezio Melotti edd117fd27 #11763: merge with 3.1. 2011-04-27 10:20:38 +03:00
Ezio Melotti 0f535013c5 #11282: add back the fail* methods and assertDictContainsSubset. 2011-04-03 18:02:13 +03:00
Ezio Melotti b7af620747 #11282: merge with 3.2. 2011-04-03 17:39:19 +03:00
Ezio Melotti 361467e522 #11282: the fail* methods will stay around a few more versions. 2011-04-03 17:37:58 +03:00
Michael Foord 1341bb0019 Closes issue 11407. TestCase.run returns the result object used or created 2011-03-14 19:01:46 -04:00
Georg Brandl 2cebdd4865 Remove unittest methods scheduled for removal in 3.3 -- makes the unittest test suite pass again. 2011-02-20 11:18:09 +00:00
Michael Foord e180d3953f Issue 10573: revert unittest docs to first / second
Minor internal change to unittest.TestCase.assertCountEqual
Reviewed by R. David Murray
2011-01-28 19:51:48 +00:00
Michael Foord 32e1d8340c Enable unittest.TestCase to be instantiated without providing a method name.
Changed unittestgui to show number of discovered tests in the status bar.
2011-01-03 17:00:11 +00:00
Raymond Hettinger 57bd00a15b Adopt symmetric names for arguments (actual/expected --> first/second). 2010-12-24 21:51:48 +00:00
Raymond Hettinger 9d668dac68 Put diff output in useful order (when the elements were first seen). 2010-12-24 11:20:30 +00:00
Raymond Hettinger 93e233d6e5 Improve diff for assertCountEqual() to actually show the differing counts.
New output looks like this:

Traceback (most recent call last):
  File "test.py", line 5, in test_ce
    self.assertCountEqual('abracadabra xx', 'simsalabim xx')
AssertionError: Element counts were not equal:
Expected 5, got 2:  'a'
Expected 2, got 1:  'b'
Expected 0, got 2:  'i'
Expected 0, got 2:  'm'
Expected 0, got 1:  'l'
Expected 0, got 2:  's'
Expected 1, got 0:  'c'
Expected 1, got 0:  'd'
Expected 2, got 0:  'r'
2010-12-24 10:02:22 +00:00
Raymond Hettinger c44befb82e Fix docstring. 2010-12-24 00:58:34 +00:00
Raymond Hettinger 6518f5e780 Fix docs and comment for r87454. 2010-12-24 00:52:54 +00:00
Raymond Hettinger d65a901aed Fix buglet. If the input was an iterator, the fallback would occur after
part of the iterator had been consumed.   Also, fix argument names which
did not match the docs and were a bit misleading.
2010-12-23 21:54:02 +00:00
Raymond Hettinger 8ebe27f300 Deprecate assertDictContainsSubset() 2010-12-21 19:24:26 +00:00
Michael Foord b3468f79ef Issue 10611. Issue 9857. Improve the way exception handling, including test skipping, is done inside TestCase.run 2010-12-19 03:19:47 +00:00
Ezio Melotti addc6f5a21 #10573: use actual/expected consistently in unittest methods. The order of the args of assertCountEqual is also changed. 2010-12-18 20:00:04 +00:00
Ezio Melotti 3044fa77a5 Use lowercase true/false in assertTrue/assertFalse messages. 2010-12-18 17:31:58 +00:00
Gregory P. Smith ed16bf4aaa assert that the regex given to assertRegex is non-empty. 2010-12-16 19:23:05 +00:00
Ezio Melotti 8f77630747 #10273: Remove a "Matches" that I missed in r86910. Thanks to RDM for noticing it. 2010-12-10 02:32:05 +00:00
Michael Foord 5074df623b Issue 7911: unittest.TestCase.longMessage defaults to True for improved failure messages by default 2010-12-03 00:53:09 +00:00
Ezio Melotti ed3a7d2d60 #10273: Rename assertRegexpMatches and assertRaisesRegexp to assertRegex and assertRaisesRegex. 2010-12-01 02:32:32 +00:00
Raymond Hettinger 40b8cf528f Do not add an obsolete unittest name to Py3.2. 2010-11-29 01:38:25 +00:00
Raymond Hettinger 6e165b30de Issue 10242: unittest.assertItemsEqual makes too many assumptions. 2010-11-27 09:31:37 +00:00
Ezio Melotti 2baf1a69f4 #9424: add a DeprecationWarning for assertEquals, assertNotEquals, assertAlmostEquals, assertNotAlmostEquals, and assert_ 2010-11-22 12:56:58 +00:00
Ezio Melotti b3aedd4862 #9424: Replace deprecated assert* methods in the Python test suite. 2010-11-20 19:04:17 +00:00
Michael Foord 8ca6d9884b Issue 10326: TestCase instances can now be pickled (they store names of instance methods instead of references to the instance methods themselves). 2010-11-20 15:34:26 +00:00
Michael Foord 321d059147 Remove the keyword only restriction for places and delta args in unittest.TestCase.assert[Not]AlmostEqual 2010-11-02 13:44:51 +00:00
Antoine Pitrou 4bc12ef47d Issue #9754: Similarly to assertRaises and assertRaisesRegexp, unittest
test cases now also have assertWarns and assertWarnsRegexp methods to
check that a given warning type was triggered by the code under test.
2010-09-06 19:25:46 +00:00
Michael Foord c653ce313f Fix error message for comparing single line strings in unittest.TestCase.assertEqual.
Issue 9174.
2010-07-10 13:52:22 +00:00
Michael Foord c41d141f4f Merged revisions 81859 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81859 | michael.foord | 2010-06-09 13:29:56 +0100 (Wed, 09 Jun 2010) | 1 line

  Typo correction.
........
2010-06-10 16:17:07 +00:00
Michael Foord b874874194 Merged revisions 81853 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81853 | michael.foord | 2010-06-08 23:44:52 +0100 (Tue, 08 Jun 2010) | 1 line

  Issue 8948. cleanup functions are not run by unittest.TestCase.debug(), plus class and module teardowns are not run by unittest.TestSuite.debug().
........
2010-06-10 16:16:08 +00:00
Michael Foord d50a6b94b7 Merged revisions 81770 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81770 | michael.foord | 2010-06-06 00:58:40 +0100 (Sun, 06 Jun 2010) | 1 line

  Code formatting change.
........
2010-06-05 23:59:34 +00:00
Michael Foord ac76074628 Merged revisions 81753 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81753 | michael.foord | 2010-06-05 14:48:27 +0100 (Sat, 05 Jun 2010) | 1 line

  Fix unittest tests after previous commit.
........
2010-06-05 13:57:23 +00:00
Michael Foord 9dad32efe8 Merged revisions 81752 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81752 | michael.foord | 2010-06-05 14:38:16 +0100 (Sat, 05 Jun 2010) | 1 line

  unittest.TestCase assertion methods inform you when they have omitted an over long diff on failure. Issue 8351.
........
2010-06-05 13:49:56 +00:00
Michael Foord cb11b251a0 Merged revisions 81747 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81747 | michael.foord | 2010-06-05 13:58:39 +0100 (Sat, 05 Jun 2010) | 1 line

  unittest.TestCase.assertDictEqual and assertMultilineEqual provide better default failure messages in the event of long diffs.
........
2010-06-05 13:14:43 +00:00
Michael Foord 085dfd3ad5 Merged revisions 81739 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81739 | michael.foord | 2010-06-05 13:10:52 +0100 (Sat, 05 Jun 2010) | 1 line

  Removed the new max_diff argument to assertSequenceEqual. All unittest.TestCase assert methods that use difflib to produce failure messages now truncate overly long messages. New class attribute unittest.TestCase.maxDiff to configure this if necessary. Issue 8351.
........
2010-06-05 12:17:02 +00:00
Michael Foord 2034d9a996 Merged revisions 81728 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81728 | michael.foord | 2010-06-05 12:23:51 +0100 (Sat, 05 Jun 2010) | 1 line

  Issue 8351. Suppress large diffs in unittest.TestCase.assertSequenceEqual.
........
2010-06-05 11:27:52 +00:00
Benjamin Peterson 899e9a0e7a remove now useless __ne__ 2010-05-11 00:07:48 +00:00
Michael Foord e3ef5f1201 Merged revisions 80990 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r80990 | michael.foord | 2010-05-08 18:40:52 +0200 (Sat, 08 May 2010) | 1 line

  Updating documentation and adding docstrings to unittest.TestCase.assertRegexpMatches and assertNotRegexpMatches. Issue 8038.
........
2010-05-08 16:46:14 +00:00
Benjamin Peterson b48af54ff7 Merged revisions 79464,79471,79623,79626,79630,79632,79643,79648-79649,79679,79685,79711,79761,79774,79777,79792-79794,79877,79898-79900 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r79464 | michael.foord | 2010-03-27 07:55:19 -0500 (Sat, 27 Mar 2010) | 1 line

  A fix for running unittest tests on platforms without the audioop module (e.g. jython and IronPython)
........
  r79471 | michael.foord | 2010-03-27 14:10:11 -0500 (Sat, 27 Mar 2010) | 4 lines

  Addition of delta keyword argument to unittest.TestCase.assertAlmostEquals and assertNotAlmostEquals

  This allows the comparison of objects by specifying a maximum difference; this includes the comparing of non-numeric objects that don't support rounding.
........
  r79623 | michael.foord | 2010-04-02 16:42:47 -0500 (Fri, 02 Apr 2010) | 1 line

  Addition of -b command line option to unittest for buffering stdout and stderr during test runs.
........
  r79626 | michael.foord | 2010-04-02 17:08:29 -0500 (Fri, 02 Apr 2010) | 1 line

  TestResult stores original sys.stdout and tests no longer use sys.__stdout__ (etc) in tests for unittest -b command line option
........
  r79630 | michael.foord | 2010-04-02 17:30:56 -0500 (Fri, 02 Apr 2010) | 1 line

  unittest tests no longer replace the sys.stdout put in place by regrtest
........
  r79632 | michael.foord | 2010-04-02 17:55:59 -0500 (Fri, 02 Apr 2010) | 1 line

  Issue #8038: Addition of unittest.TestCase.assertNotRegexpMatches
........
  r79643 | michael.foord | 2010-04-02 20:15:21 -0500 (Fri, 02 Apr 2010) | 1 line

  Support dotted module names for test discovery paths in unittest. Issue 8038.
........
  r79648 | michael.foord | 2010-04-02 21:21:39 -0500 (Fri, 02 Apr 2010) | 1 line

  Cross platform unittest.TestResult newline handling when buffering stdout / stderr.
........
  r79649 | michael.foord | 2010-04-02 21:33:55 -0500 (Fri, 02 Apr 2010) | 1 line

  Another attempt at a fix for unittest.test.test_result for windows line endings
........
  r79679 | michael.foord | 2010-04-03 09:52:18 -0500 (Sat, 03 Apr 2010) | 1 line

  Adding -b command line option to the unittest usage message.
........
  r79685 | michael.foord | 2010-04-03 10:20:00 -0500 (Sat, 03 Apr 2010) | 1 line

  Minor tweak to unittest command line usage message
........
  r79711 | michael.foord | 2010-04-03 12:03:11 -0500 (Sat, 03 Apr 2010) | 1 line

  Documenting new features in unittest
........
  r79761 | michael.foord | 2010-04-04 17:41:54 -0500 (Sun, 04 Apr 2010) | 1 line

  unittest documentation formatting changes
........
  r79774 | michael.foord | 2010-04-04 18:28:44 -0500 (Sun, 04 Apr 2010) | 1 line

  Adding documentation for new unittest.main() parameters
........
  r79777 | michael.foord | 2010-04-04 19:39:50 -0500 (Sun, 04 Apr 2010) | 1 line

  Document signal handling functions in unittest.rst
........
  r79792 | michael.foord | 2010-04-05 05:26:26 -0500 (Mon, 05 Apr 2010) | 1 line

  Documentation fixes for unittest
........
  r79793 | michael.foord | 2010-04-05 05:28:27 -0500 (Mon, 05 Apr 2010) | 1 line

  Furterh documentation fix for unittest.rst
........
  r79794 | michael.foord | 2010-04-05 05:30:14 -0500 (Mon, 05 Apr 2010) | 1 line

  Further documentation fix for unittest.rst
........
  r79877 | michael.foord | 2010-04-06 18:18:16 -0500 (Tue, 06 Apr 2010) | 1 line

  Fix module directory finding logic for dotted paths in unittest test discovery.
........
  r79898 | michael.foord | 2010-04-07 18:04:22 -0500 (Wed, 07 Apr 2010) | 1 line

  unittest.result.TestResult does not create its buffers until they're used. It uses StringIO not cStringIO. Issue 8333.
........
  r79899 | michael.foord | 2010-04-07 19:04:24 -0500 (Wed, 07 Apr 2010) | 1 line

  Switch regrtest to use StringIO instead of cStringIO for test_multiprocessing on Windows. Issue 8333.
........
  r79900 | michael.foord | 2010-04-07 23:33:20 -0500 (Wed, 07 Apr 2010) | 1 line

  Correction of unittest documentation typos and omissions
........
2010-04-11 20:43:16 +00:00
Benjamin Peterson dccc1fcfaf Merged revisions 79263 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r79263 | michael.foord | 2010-03-21 19:06:30 -0500 (Sun, 21 Mar 2010) | 1 line

  Issue 7815. __unittest in module globals trims frames from reported stacktraces in unittest.
........
2010-03-22 00:15:53 +00:00
Michael Foord 91c9da34bc Issue 7832. Deprecating assertSameElements in Py3k. 2010-03-20 17:21:27 +00:00
Michael Foord 8442a606b8 Adding assertItemsEqual with tests. Issue 7832. assertSameElements still needs to be deprecated plus documentation needs to be updated. 2010-03-20 16:58:04 +00:00
Benjamin Peterson 847a4110ea Merged revisions 78227,78229,78288,78348,78377,78770,78774-78776,78810 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78227 | michael.foord | 2010-02-18 14:30:09 -0600 (Thu, 18 Feb 2010) | 1 line

  unittest.TestCase uses safe_repr for producing failure messages. Partial fix for issue 7956
........
  r78229 | michael.foord | 2010-02-18 15:37:07 -0600 (Thu, 18 Feb 2010) | 1 line

  Fix unittest.TestCase.assertDictContainsSubset so it can't die with unicode issues when constructing failure messages. Issue 7956
........
  r78288 | michael.foord | 2010-02-21 08:48:59 -0600 (Sun, 21 Feb 2010) | 1 line

  Silence UnicodeWarning in crazy unittest test.
........
  r78348 | michael.foord | 2010-02-22 17:28:32 -0600 (Mon, 22 Feb 2010) | 1 line

  Support for old TestResult object (unittest) with warnings when using unsupported features.
........
  r78377 | michael.foord | 2010-02-23 11:00:53 -0600 (Tue, 23 Feb 2010) | 1 line

  unittest.TestResult can now be used with the TextTestRunner. TextTestRunner compatible with old TestResult objects.
........
  r78770 | michael.foord | 2010-03-07 14:22:12 -0600 (Sun, 07 Mar 2010) | 1 line

  Fix for potentials errors in constructing unittest failure messages. Plus skipped test methods no longer run setUp and tearDown (Issue 8059)
........
  r78774 | michael.foord | 2010-03-07 16:04:55 -0600 (Sun, 07 Mar 2010) | 1 line

  Addition of setUpClass and setUpModule shared fixtures to unittest.
........
  r78775 | michael.foord | 2010-03-07 17:10:36 -0600 (Sun, 07 Mar 2010) | 1 line

  Fix accidental name rebinding in unittest py3k warning filtering.
........
  r78776 | michael.foord | 2010-03-07 17:16:20 -0600 (Sun, 07 Mar 2010) | 1 line

  Remove accidental print statement from last commit.
........
  r78810 | raymond.hettinger | 2010-03-09 02:44:18 -0600 (Tue, 09 Mar 2010) | 5 lines

  Improve the basic example.
  * Show both the decorator and regular form for assertRaises()
  * Use assertTrue() instead of assertIn() to teach useful minimal subset of the API
........
2010-03-14 15:04:17 +00:00