Michael Foord
75963643b1
Fix exception when calling reset_mock on a mock created with autospec
2012-06-09 17:31:59 +01:00
Nick Coghlan
0b43bcf528
Close #14857 : fix regression in references to PEP 3135 implicit __class__ closure variable. Reopens issue #12370 , but also updates unittest.mock to workaround that issue
2012-05-27 18:17:07 +10:00
Antoine Pitrou
f99983dacb
Issue #14664 : It is now possible to use @unittest.skip{If,Unless} on a test class that doesn't inherit from TestCase (i.e. a mixin).
2012-04-25 14:58:17 +02:00
Antoine Pitrou
b05ac864f0
Issue #14664 : It is now possible to use @unittest.skip{If,Unless} on a test class that doesn't inherit from TestCase (i.e. a mixin).
2012-04-25 14:56:46 +02:00
Michael Foord
9cf5c9d85e
Remove incorrect comment
2012-04-21 18:32:56 +01:00
Michael Foord
3af125a4aa
Closes issue 14634. unittest.mock.create_autospec now supports keyword only arguments.
2012-04-21 18:22:28 +01:00
Michael Foord
2cd48738ba
Closes issue 14636. mock objects raise exceptions from an iterable side_effect
2012-04-21 15:52:11 +01:00
Michael Foord
0682a0c0a9
Minor docstring / docs corrections for unittest.mock
2012-04-13 20:51:20 +01:00
Michael Foord
656319e58d
Make unittest.mock.create_autospec resilient against AttributeError on original object
2012-04-13 17:39:16 +01:00
Michael Foord
c287062fcf
unittest.mock.PropertyMock return value and attributes are now standard MagicMocks
2012-04-13 16:57:22 +01:00
Michael Foord
aa8ec7e076
Fix unittest.mock.patch docstring
2012-03-28 15:41:28 +01:00
Michael Foord
54b3db8c84
Minor unittest.mock.patch doc / docstring improvement
2012-03-28 15:08:08 +01:00
Michael Foord
0340ea77d1
unittest.mock: removed another bit of Python 2 only code
2012-03-25 23:27:12 +01:00
Michael Foord
944e02d055
Adding unittest.mock documentation
2012-03-25 23:12:55 +01:00
Michael Foord
e58a562d93
unittest.mock: a mock created by patch with a spec as the list argument will be callable if __call__ is in the spec
2012-03-25 19:53:18 +01:00
Michael Foord
fb5d0a78cf
unittest.mock: remove another piece of Python 2 specific code
2012-03-25 19:35:22 +01:00
Michael Foord
1ab27c6fde
Remove more Python 2 code from unittest.mock (obsolete function attributes)
2012-03-25 19:16:10 +01:00
Michael Foord
0dccf657b5
Minor changes to the unittest.mock.mock_open helper
2012-03-25 19:11:50 +01:00
Michael Foord
99254730b2
Addition of docstrings to unittest.mock helpers
2012-03-25 19:07:33 +01:00
Michael Foord
a74561a56d
unittest.mock: set file_spec on first use
2012-03-25 19:03:13 +01:00
Michael Foord
50a8c0ef5d
Support subclassing unittest.mock._patch and fix various obscure bugs around patcher spec arguments
2012-03-25 18:57:58 +01:00
Michael Foord
313f85f0ca
unittest.mock.MagicMock objects are now unorderable by default
2012-03-25 18:16:07 +01:00
Michael Foord
d7c65e2807
Removed XXX from unittest.mock docstring and switch to a nicer try...except...finally
2012-03-14 14:56:54 -07:00
Michael Foord
a74b3aa0cc
Remove more Python 2 compatibility cruft from unittest.mock
2012-03-14 14:40:22 -07:00
Michael Foord
c17adf4151
Remove Python 2 compatibility cruft from unittest.mock
2012-03-14 13:30:29 -07:00
Michael Foord
ebff097937
And another one... mock import fix.
2012-03-14 13:01:31 -07:00
Michael Foord
83a16856ee
Fix another mock import
2012-03-14 12:58:46 -07:00
Michael Foord
0ca9acd1dd
Fix import failure in mock test
2012-03-14 12:38:06 -07:00
Michael Foord
345266aa7e
PEP 417: Adding unittest.mock
2012-03-14 12:24:34 -07:00
Michael Foord
5738e4f3df
Merge
2012-03-13 00:14:19 -07:00
Michael Foord
e01c62cd6b
Fix unittest test discovery for Jython
2012-03-13 00:09:54 -07:00
Michael Foord
b36c70c9ff
Move adding unittest test discovery command line options into their own method.
2012-03-12 15:24:46 -07:00
Michael Foord
5f99ced092
Refactor unittest command line handling to always use optparse
2012-03-12 13:53:04 -07:00
Senthil Kumaran
5d036e1ccf
merge from 3.2 testFnNames is assigned twice.
2011-11-25 02:09:24 +08:00
Senthil Kumaran
f27be5c60b
testFnNames is assigned twice.
2011-11-25 02:08:39 +08:00
Florent Xicluna
c53ae58954
Drop unused import in unittest package.
2011-11-04 08:25:54 +01:00
Florent Xicluna
5d1155c08e
Closes #13258 : Use callable() built-in in the standard library.
2011-10-28 14:45:05 +02:00
Florent Xicluna
aabbda5354
Merge 3.2
2011-10-28 14:52:29 +02:00
Ezio Melotti
d8b509b192
#13012 : use splitlines(keepends=True/False) instead of splitlines(0/1).
2011-09-28 17:37:55 +03:00
Benjamin Peterson
b6ffa7980f
test that TestCase doesn't get cycles
2011-07-14 12:48:25 -05: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
Ezio Melotti
45763d0d12
Merge with 3.2.
2011-03-20 15:34:28 +02:00
Ezio Melotti
60c3c9f918
Save a copy of sys.warnoptions in test_program.
2011-03-20 15:31:26 +02:00
Michael Foord
42ec7cb105
Issue #10979 . unittest stdout buffering now works with class and module setup and teardown.
2011-03-17 13:44:18 -04:00
Victor Stinner
98dbba5d20
Issue #3080 : Use repr() to format the module name on error
2011-03-14 15:15:47 -04:00
Michael Foord
e9ff2ef204
Closes issue 10979. unittest buffering now works with class and module setup and teardown
2011-03-17 13:58:22 -04: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
Victor Stinner
cae969e70a
fix test_unittest: ignore DeprecationWarning on assertDictContainsSubset()
2011-01-03 23:56:12 +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
Michael Foord
6f17e2df29
Issue 10786: unittest.TextTestRunner default stream no longer bound at import time
2010-12-30 19:36:29 +00:00
Raymond Hettinger
57bd00a15b
Adopt symmetric names for arguments (actual/expected --> first/second).
2010-12-24 21:51:48 +00:00
Raymond Hettinger
efbcb1b038
Keep helper functions private.
2010-12-24 11:24:00 +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
f954217458
Add direct tests for the util functions.
2010-12-24 10:30:06 +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
83961245b4
Add test for r87454.
2010-12-24 00:48:47 +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
cca5be2e4c
Improvement to fix for issue 9926 to allow TestResult to be reused.
2010-12-19 04:07:28 +00:00
Michael Foord
f100dbd600
Fix minor issue in implementation of issue 10470.
2010-12-19 03:59:10 +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
36526bf3d9
Correct comment in unittest test
2010-12-04 01:43:59 +00:00
Michael Foord
37d120aeb4
Issue 10620: Specifying test modules by path instead of module name to 'python -m unittest'
2010-12-04 01:11:21 +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
Ezio Melotti
f10c400b91
Fix test failure in debug builds and add NEWS entry for r86908
2010-12-01 01:45:53 +00:00
Ezio Melotti
6090187656
#10535 : Enable silenced warnings in unittest by default
2010-12-01 00:56:10 +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
Michael Foord
b87ef8f872
Improve test for 'python -m unittest' launching test discovery
2010-11-22 10:41:27 +00:00
Michael Foord
086f30815c
Issue 10470: 'python -m unittest' launches test discovery by default.(If you need to pass options to test discovery the discover subcommand must still be specified explicitly.)
2010-11-21 21:28:01 +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
6bcfadec07
Improve unittest.TestLoader.discover docstring
2010-11-20 17:22:21 +00:00
Michael Foord
b357fb7bed
Issue 10326: further extend test for unpickling to ensure type lookup mechanism works after unpickling
2010-11-20 15:47:56 +00:00
Michael Foord
8a00eec2a8
Issue 10326: extend test for pickling of TestCase instances to ensure they can be unpickled too
2010-11-20 15:43:02 +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
Benjamin Peterson
29bd840dee
reduce try block compass
2010-11-18 14:14:43 +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
Michael Foord
bbea35f194
Fix issue 9926. TestSuite subclasses that override __call__ are called correctly.
2010-11-01 21:09:03 +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
2b293cf1a5
Merged revisions 81878 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r81878 | michael.foord | 2010-06-10 21:40:21 +0100 (Thu, 10 Jun 2010) | 2 lines
Fix issue with nested test suites debug method and module setups. (unittest)
........
2010-06-10 20:41:54 +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