Commit Graph

311 Commits

Author SHA1 Message Date
Benjamin Peterson e87b7eafe4 fix windows tests (#16662)
From Robert Collins.
2014-09-29 21:54:28 -04:00
Kushal Das a37b958d65 Closes #21270 : We now override tuple methods in mock.call objects. 2014-09-16 18:33:37 +05:30
Barry Warsaw bb1e3f1ebe A few tweaks for issue16662 based on feedback from Robert Collins. 2014-09-08 17:29:02 -04:00
Barry Warsaw d78742a260 - Issue #16662: load_tests() is now unconditionally run when it is present in
a package's __init__.py.  TestLoader.loadTestsFromModule() still accepts
  use_load_tests, but it is deprecated and ignored.  A new keyword-only
  attribute `pattern` is added and documented.  Patch given by Robert Collins,
  tweaked by Barry Warsaw.
2014-09-08 14:21:37 -04:00
Ezio Melotti 869778e520 #22092: merge with 3.4. 2014-08-07 03:28:26 +03:00
Ezio Melotti 1241c47aa2 #22092: use absolute imports in unittest tests. Patch by Vajrasky Kok. 2014-08-07 03:20:22 +03:00
Serhiy Storchaka 521e5860a5 Issue #22032: __qualname__ instead of __name__ is now always used to format
fully qualified class names of Python implemented classes.
2014-07-22 15:00:37 +03:00
R David Murray 130a566a13 Suppress a couple more DeprecationWarnings in the test suite. 2014-06-11 17:09:43 -04:00
Kushal Das 047f14c3c6 Closes #21256: Printout of keyword args in deterministic order in mock calls.
Printout of keyword args should be in deterministic order in
a mock function call. This will help to write better doctests.
2014-06-09 13:45:56 +05:30
Antoine Pitrou b1e58440f8 Issue #9815: assertRaises now tries to clear references to local variables in the exception's traceback. 2014-04-29 01:25:07 +02:00
Antoine Pitrou 9681022f1e Issue #9815: assertRaises now tries to clear references to local variables in the exception's traceback. 2014-04-29 01:23:50 +02:00
Ethan Furman 7b9ff0e6da Issue8297: module attribute lookup failures now include module name in error message. 2014-04-24 14:47:47 -07:00
Michael Foord ebc1a30d55 Closes issue 21239. unittest.mock.patch.stopall() did not work deterministically when the same name was patched multiple times. 2014-04-15 17:21:08 -04:00
Kushal Das 484f8a875b Closes Issue 21222.
Passing name keyword argument to mock.create_autospec now works.
2014-04-16 01:05:50 +05:30
Mark Dickinson d12290654a Fix typo in test method name. 2014-04-18 16:08:47 +01:00
Kushal Das 68290f4895 Removes unused varargs and varkwargs from assert_not_called(). 2014-04-17 01:54:07 +05:30
Kushal Das 8af9db3e4f Closes Issue 21262: New method assert_not_called for Mock.
It raises AssertionError if the mock has been called.
2014-04-17 01:36:14 +05:30
Kushal Das 8c14534df6 Closes Issue 21238: New keyword argument `unsafe` to Mock.
It raises `AttributeError` incase of an attribute startswith assert
or assret.
2014-04-16 23:32:21 +05:30
Michael Foord 15f2d1775e Merge 2014-04-15 17:22:22 -04:00
Kushal Das 5d1f6c3b15 Merge 2014-04-16 01:22:52 +05:30
Michael Foord fddcfa27fa Closes issue 17660. You no longer need to explicitly pass create=True when patching builtin names. 2014-04-14 16:25:20 -04:00
Michael Foord 01bafdcccc Issue 17826. Setting an iterable side_effect on a mock created by create_autospec now works 2014-04-14 16:09:42 -04:00
Michael Foord d2623d7786 Issue 20968. unittest.mock.MagicMock now supports division 2014-04-14 11:23:48 -04:00
R David Murray ef1c26798c backport: #20145: assert[Raises|Warns]Regex now raise TypeError on bad regex.
Previously a non-string, non-regex second argument and missing callable
argument could cause the test to appear to always pass.

Initial patch by Kamilla Holanda.
2014-03-25 15:31:50 -04:00
Larry Hastings 5c66189e88 Issue #20189: Four additional builtin types (PyTypeObject,
PyMethodDescr_Type, _PyMethodWrapper_Type, and PyWrapperDescr_Type)
have been modified to provide introspection information for builtins.
Also: many additional Lib, test suite, and Argument Clinic fixes.
2014-01-24 06:17:25 -08:00
Gregory P. Smith 5a6d4bf671 Fixes Issue #20165: The unittest module no longer considers tests marked with
@expectedFailure successful if they pass.
2014-01-20 01:11:18 -08:00
Antoine Pitrou b5c66f8645 Fix breakage in TestSuite.countTestCases() introduced by issue #11798. 2013-12-28 20:37:58 +01:00
Serhiy Storchaka 184ec79bd3 Remove commented out debugging code (remnants of issue #18996). 2013-12-10 13:53:56 +02:00
Victor Stinner 031bd532c4 Close #19880: Fix a reference leak in unittest.TestCase. Explicitly break
reference cycles between frames and the _Outcome instance.
2013-12-09 01:52:50 +01:00
Michael Foord 514afeb65c Merge 2013-11-23 13:30:03 +00:00
Michael Foord e28bb15054 Issue 17457: extend test discovery to support namespace packages 2013-11-23 13:29:23 +00:00
Serhiy Storchaka bc39869095 Issue #19594: Use specific asserts in unittest tests. 2013-11-17 00:14:35 +02:00
Serhiy Storchaka 5665bc5980 Issue #19594: Use specific asserts in unittest tests. 2013-11-17 00:12:21 +02:00
Antoine Pitrou 6c6b3f770d Issue #19352: Fix unittest discovery when a module can be reached through several paths (e.g. under Debian/Ubuntu with virtualenv). 2013-10-23 19:15:05 +02:00
Antoine Pitrou d5d0bc35ad Issue #19352: Fix unittest discovery when a module can be reached through several paths (e.g. under Debian/Ubuntu with virtualenv). 2013-10-23 19:11:29 +02:00
Serhiy Storchaka 77622f55c2 Issue #18996: TestCase.assertEqual() now more cleverly shorten differing
strings in error report.
2013-09-23 23:07:00 +03:00
Michael Foord 468ec34084 Remove shadowed test 2013-09-15 20:05:19 +12:00
Antoine Pitrou 0715b9fad3 Issue #18937: Add an assertLogs() context manager to unittest.TestCase to ensure that a block of code emits a message using the logging module. 2013-09-14 19:45:47 +02:00
Antoine Pitrou a19b1a664f Adjust comment 2013-09-14 00:40:46 +02:00
Antoine Pitrou 4b3c58c8a0 Issue #19013: add a __main__ to unittest.test.testmock to ease CLI invocation 2013-09-14 00:39:15 +02:00
Antoine Pitrou e1ba8df182 Issue #19013: add a __main__ to unittest.test to ease CLI invocation 2013-09-14 00:37:18 +02:00
Antoine Pitrou 356bdeb0a1 Issue #19013: add unittest.main() epilogs to unittest.mock's own test modules 2013-09-13 23:54:01 +02:00
Antoine Pitrou 1d7c8c9a00 Issue #19013: add unittest.main() epilogs to unittest's own test modules 2013-09-13 23:52:46 +02:00
Mark Dickinson 23543ebd86 Merge docstring typo fix from 3.3 2013-09-09 10:34:56 +01:00
Mark Dickinson 51ef074d57 Docstring typo fix: Arithmentic -> Arithmetic. 2013-09-09 10:34:24 +01:00
Andrew Svetlov 8913a6c83d Issue #11798: fix tests for regrtest -R : 2013-09-01 07:58:41 +03:00
Tim Peters 59360aadd3 Back out 868ad6fa8e68 - it left all the buildbots failing.
Unclear to me why it was pushed to begin with.  See issue 11798.
Perhaps it's because regrtest with -R was failing?  Fine, but
that's better than regrtest _always_ failing ;-)
2013-08-31 23:44:34 -05:00
Andrew Svetlov a41213726b Temporary disable tests cleanup (issue 11798). 2013-08-31 20:55:25 +03:00
Serhiy Storchaka de2800f8f1 Issue #17974: Switch unittest from using getopt to using argparse. 2013-08-29 12:37:28 +03:00
Andrew Svetlov eb97368451 Issue #11798: TestSuite now drops references to own tests after execution. 2013-08-28 21:28:38 +03:00
Ezio Melotti e0c69161bc #18741: merge with 3.3. 2013-08-17 16:13:22 +03:00
Ezio Melotti b5bc353b88 #18741: fix more typos. Patch by Févry Thibault. 2013-08-17 16:11:40 +03:00
Ezio Melotti b2855ccd09 #18663: merge with 3.3. 2013-08-11 13:05:37 +03:00
Ezio Melotti d51914c6c1 #18663: document that assertAlmostEqual also works when the values are equal and add tests. 2013-08-11 13:04:50 +03:00
Łukasz Langa 06d3abbff3 clean the environment from pre-existing PYTHONWARNINGS for test_warnings 2013-04-24 01:51:42 +02:00
Łukasz Langa 6ae466732c clean the environment from pre-existing PYTHONWARNINGS for test_warnings 2013-04-24 01:49:52 +02:00
R David Murray c601dc1639 Merge #14971: Use class method name, not function.__name__, during unittest discovery. 2013-04-11 08:58:11 -04:00
R David Murray 5e2f593145 #14971: Use class method name, not function.__name__, during unittest discovery. 2013-04-11 08:55:45 -04:00
Andrew Svetlov 8ab1e513c1 Process DEFAULT values in mock side_effect that returns iterator.
Patch by Michael Ford.
2013-04-07 16:44:07 +03:00
Andrew Svetlov 8b2cd75bdd Process DEFAULT values in mock side_effect that returns iterator.
Patch by Michael Ford.
2013-04-07 16:42:24 +03:00
Antoine Pitrou 22e162f462 Fix bug in TestResult.addSubTest() 2013-03-29 17:55:24 +01:00
Ezio Melotti 85a25222bc #8906: merge with 3.3. 2013-03-29 03:43:38 +02:00
Ezio Melotti 31797e5efe #8906: document failureException, longMessage, and maxDiff in the class docstring. Patch by Boris Feld. 2013-03-29 03:42:29 +02:00
Ezio Melotti 67ddccafc3 #17329: merge with 3.3. 2013-03-27 20:13:59 +02:00
Ezio Melotti 184e59357e #17329: merge with 3.2. 2013-03-27 20:12:55 +02:00
Ezio Melotti 265281ac02 #17329: document unittest.SkipTest. Initial patch by Zachary Ware. 2013-03-27 20:11:55 +02:00
Ezio Melotti 89e6b31845 #17504: merge with 3.3. 2013-03-24 16:10:51 +02:00
Ezio Melotti 31a7835df8 #17504: remove duplicated sentence. Patch by Radu Voicilas. 2013-03-24 16:10:24 +02:00
Ezio Melotti cf936c7287 #17510: avoid using deprecated assertEquals method in test_program. Patch by Daniel Black. 2013-03-23 16:46:23 +02:00
Antoine Pitrou c9b3ef2df0 Issue #16997: unittest.TestCase now provides a subTest() context manager to procedurally generate, in an easy way, small test instances. 2013-03-20 20:16:47 +01:00
Michael Foord 04cbe0c35b Closes issue 17467. Add readline and readlines support to unittest.mock.mock_open 2013-03-19 17:22:51 -07:00
Michael Foord 80cbc9e998 Closes issue 16709. unittest test discovery sorts test files for consistent test ordering 2013-03-18 17:50:12 -07:00
Terry Jan Reedy 8b53559a89 Merge with 3.3, issue #17047: remove doubled words added in 3.3,
as reported by Serhiy Storchaka and Matthew Barnett.
2013-03-11 18:36:38 -04:00
Terry Jan Reedy 0f84764a09 Issue #17047: remove doubled words added in 3.3
as reported by Serhiy Storchaka and Matthew Barnett.
2013-03-11 18:34:00 -04:00
Ezio Melotti eae2b38948 #16935: unittest now counts the module as skipped if it raises SkipTest, instead of counting it as an error. Patch by Zachary Ware. 2013-03-01 14:47:50 +02:00
Petri Lehtinen 20054477f4 Issue #15132: Allow a list for the defaultTest argument of unittest.TestProgram
Patch by Jyrki Pulliainen
2013-02-23 18:55:49 +01:00
Michael Foord 890d72d3c9 Merge. Closes issue 17052. 2013-02-11 13:33:00 +00:00
Michael Foord b71b8ec7b1 Merge 2013-02-11 13:29:58 +00:00
Michael Foord f78f5b11f6 Correction to issue 17052 fix 2013-02-11 13:20:52 +00:00
Michael Foord 4e08f786f0 Merge. Closes issue 17052. 2013-02-11 00:28:02 +00:00
Michael Foord a23a39c07d Merge 2013-02-11 00:18:07 +00:00
Michael Foord 8fd396bd22 Issue 17502: unittest discovery should use self.testLoader 2013-02-11 00:04:24 +00:00
Antoine Pitrou 5c64df70b5 Issue #17015: When it has a spec, a Mock object now inspects its signature when matching calls, so that arguments can be matched positionally or by name. 2013-02-03 00:23:58 +01:00
Michael Foord beb29b1f6c Merge 2013-01-29 23:18:48 +00:00
Michael Foord d1da29c99d Merge 2013-01-29 23:14:59 +00:00
Michael Foord 6debd76939 Closes issue 15505. unittest.installHandler and non-callable signal handlers. 2013-01-29 23:07:57 +00:00
Andrew Svetlov a191959849 Issue #16714: use 'raise' exceptions, don't 'throw'.
Patch by Serhiy Storchaka.
2012-12-18 21:27:16 +02:00
Andrew Svetlov 5b89840d9c Issue #16714: use 'raise' exceptions, don't 'throw'.
Patch by Serhiy Storchaka.
2012-12-18 21:26:36 +02:00
Andrew Svetlov 737fb89dd1 Issue #16714: use 'raise' exceptions, don't 'throw'.
Patch by Serhiy Storchaka.
2012-12-18 21:14:22 +02:00
Ezio Melotti dee9043423 #16433: merge with 3.3. 2012-11-08 11:09:28 +02:00
Ezio Melotti 9cfa1ff891 #16433: merge with 3.2. 2012-11-08 11:09:13 +02:00
Ezio Melotti 90eea97a33 #16433: fix docstring of assertNotEqual. 2012-11-08 11:08:39 +02:00
Benjamin Peterson 29e02a2be8 merge 3.3 2012-10-09 11:16:13 -04:00
Benjamin Peterson b29614e047 compare singletons by identity not equality (closes #16712)
Patch from Serhiy Storchaka.
2012-10-09 11:16:03 -04:00
Andrew Svetlov 7d14015e62 Issue #16120: Use |yield from| in stdlib.
Patch by Berker Peksag.
2012-10-06 17:11:45 +03:00
Michael Foord 28d591ceef Closes issue 15323. Improve failure message of Mock.assert_called_once_with 2012-09-28 16:15:22 +01:00
Michael Foord 8ef1fcecc5 Merge 2012-09-28 15:19:45 +01:00
Michael Foord d38e6e516d Closes issue 16064. No longer hard code executable name in unittest help output. 2012-09-28 15:14:37 +01:00
Michael Foord 7a1901f861 Closes issue #12376 : Pass on parameters in unittest.TextTestResult.__init__ super call 2012-09-28 14:14:03 +01:00
Michael Foord f7c4158057 Adding patch.stopall method to unittest.mock 2012-06-10 20:36:32 +01:00