Serhiy Storchaka
34fd4c2019
bpo-35133: Fix mistakes when concatenate string literals on different lines. (GH-10284)
...
Two kind of mistakes:
1. Missed space. After concatenating there is no space between words.
2. Missed comma. Causes unintentional concatenating in a list of strings.
2018-11-05 16:20:25 +02:00
Petter Strandmark
47d94241a3
bpo-35047, unittest.mock: Better error messages on assert_called_xxx failures (GH-10090)
...
unittest.mock now includes mock calls in exception messages if
assert_not_called, assert_called_once, or assert_called_once_with
fails.
2018-10-28 21:37:10 +01:00
Max Bélanger
6c83d9f4a7
bpo-35022: unittest.mock.MagicMock now also supports __fspath__ (GH-9960)
...
The MagicMock class supports many magic methods, but not __fspath__. To ease
testing with modules such as os.path, this function is now supported by default.
2018-10-25 23:48:58 +02:00
Mario Corchero
96200eb2ff
unittest.mock doc: Fix references to recursive seal of Mocks (GH-9028)
...
The docs in `library/unittest.mock` have been updated to remove
confusing terms about submock and be explicit about the behavior
expected.
2018-10-19 23:57:37 +02:00
Bruno Oliveira
da2bf9f66d
bpo-34900: Make TestCase.debug() work with subtests (GH-9707)
2018-10-12 13:35:55 +03:00
Tony Flury
2087023fde
bpo-32933: Implement __iter__ method on mock_open() (GH-5974)
2018-09-13 01:21:16 +03:00
Serhiy Storchaka
77d5781835
bpo-34318: Convert deprecation warnings to errors in assertRaises() etc. (GH-8623)
2018-08-19 10:00:11 +03:00
davidair
2b32da2fea
Improve error message when mock.assert_has_calls fails (GH-8205)
...
This makes the assertion error message more useful, aiding debugging.
Thanks @davidair!
2018-08-17 12:09:58 -07:00
Victor Stinner
fd8fbce495
bpo-33746: Fix test_unittest.testRegisterResult() in verbose mode (GH-7799)
...
Only make sure that the result is in unittest.signals._results, don't
check the full content of unittest.signals._results.
support._run_suite() uses TextTestRunner in verbose mode, but
TextTestRunner.run() calls registerResult(result) which made the test
fail with "odd object in result set".
Call also removeResult() to restore unittest.signals._results to
avoid test side effect.
2018-06-20 11:29:33 +02:00
Ned Deily
9d6d06e806
pypi.python.org -> pypi.org (GH-7613)
2018-06-11 00:45:50 -04:00
Tal Einat
4ab4695388
bpo-33748: fix tests altering sys.path and sys.modules (GH-7433)
2018-06-10 10:10:28 +03:00
John Reese
6c4fab0f4b
bpo-33516: Add support for __round__ in MagicMock (GH-6880)
...
unittest.mock.MagicMock now supports the __round__() magic method.
2018-05-22 22:01:10 +02:00
Leo Arias
c3d9508ff2
bpo-32746: Fix multiple typos (GH-5144)
...
Fix typos found by codespell in docs, docstrings, and comments.
2018-02-03 19:36:10 -05:00
Srinivas Reddy Thatiparthy (శ్రీనివాస్ రెడ్డి తాటిపర్తి)
018e1b7aad
bpo-32360: unittest.util: Use Counter instead of custom count function (GH-4994)
2018-01-24 16:49:58 +09:00
Victor Stinner
13ff24582c
bpo-32593: Drop FreeBSD 9 and older support ( #5232 )
...
Drop support of FreeBSD 9 and older.
2018-01-22 18:32:50 +01:00
Mike
53f7a7c281
bpo-32297: Few misspellings found in Python source code comments. ( #4803 )
...
* Fix multiple typos in code comments
* Add spacing in comments (test_logging.py, test_math.py)
* Fix spaces at the beginning of comments in test_logging.py
2017-12-14 13:04:53 +02:00
Victor Stinner
747f48e2e9
bpo-32230: Set sys.warnoptions with -X dev ( #4820 )
...
Rather than supporting dev mode directly in the warnings module, this
instead adjusts the initialisation code to add an extra 'default'
entry to sys.warnoptions when dev mode is enabled.
This ensures that dev mode behaves *exactly* as if `-Wdefault` had
been passed on the command line, including in the way it interacts
with `sys.warnoptions`, and with other command line flags like `-bb`.
Fix also bpo-20361: have -b & -bb options take precedence over any
other warnings options.
Patch written by Nick Coghlan, with minor modifications of Victor Stinner.
2017-12-12 22:59:48 +01:00
Jonas Haag
4d193bcc25
bpo-32071: Fix regression and add What's New entry ( #4589 )
...
* bpo-32071: Fix an undocumented behaviour regression
* bpo-32071: Add 3.7 release note entry for unittest -k
2017-11-28 20:40:44 +01:00
Jonas Haag
5b48dc638b
bpo-32071: Add unittest -k option ( #4496 )
...
* bpo-32071: Add unittest -k option
2017-11-25 16:23:52 +01:00
luzpaz
a5293b4ff2
Fix miscellaneous typos ( #4275 )
2017-11-05 15:37:50 +02:00
Ron
032a6480e3
Update TestCase.assertAlmostEqual and assertNotAlmostEqual docstrings. (GH-3998)
...
The word "difference" from missing the sentence.
This clarifies that it compares the difference between the two objects.
2017-10-18 10:01:23 -07:00
Mario Corchero
552be9d7e6
bpo-30541: Add new method to seal mocks (GH61923)
...
The new method allows the developer to control when to stop the
feature of mocks that automagically creates new mocks when accessing
an attribute that was not declared before
Signed-off-by: Mario Corchero <mariocj89@gmail.com>
2017-10-17 04:35:11 -07:00
Serhiy Storchaka
0b5e61ddca
bpo-30397: Add re.Pattern and re.Match. ( #1646 )
2017-10-04 20:09:49 +03:00
Ville Skyttä
49b2734bf1
Spelling fixes ( #2902 )
2017-08-03 09:00:59 +03:00
Aaron Gallagher
856cbcc12f
bpo-29403: Fix mock's broken autospec behavior on method-bound builtin functions (GH-3)
...
Cython will, in the right circumstances, offer a MethodType instance
where im_func is a builtin function. Any instance of MethodType is
automatically assumed to be a Python-defined function (more
specifically, a function that has an inspectable signature), but
_set_signature was still conservative in its assumptions. As a result
_set_signature would return early with None instead of a mock since
the im_func had no inspectable signature. This causes problems
deeper inside mock, as _set_signature is assumed to _always_
return a mock, and nothing checked its return value.
In similar corner cases, autospec will simply not check the spec of the
function, so _set_signature is amended to now return early with the
original, not-wrapped mock object.
Patch by Aaron Gallagher.
2017-07-20 03:01:14 +03:00
Victor Stinner
e4f9a2d2be
bpo-30813: Fix unittest when hunting refleaks ( #2502 )
...
bpo-11798, bpo-16662, bpo-16935, bpo-30813: Skip
test_discover_with_module_that_raises_SkipTest_on_import() and
test_discover_with_init_module_that_raises_SkipTest_on_import() of
test_unittest when hunting reference leaks using regrtest.
2017-06-30 12:52:52 +02:00
Serhiy Storchaka
48fbe52ac7
bpo-30664: The description of a unittest subtest now preserves the ( #2265 )
...
order of keyword arguments of TestCase.subTest().
2017-06-23 21:47:39 +03:00
Giampaolo Rodola
c4750959ac
#30190 : fix invalid escape sequence warnings ( #1534 )
2017-05-10 20:13:20 +02:00
Giampaolo Rodola
5d7a8d0c13
bpo-30190: improved error msg for assertAlmostEqual(delta=...) ( #1331 )
...
* #30190 / unittest / assertAlmostEqual(delta=...) / error msg: show the difference between the 2 numbers in case of failure
* safe_repr() diff
* also show difference when passing 'places' argument
* refactoring
* update Misc/NEWS
2017-05-01 18:18:56 +02:00
Louie Lu
f7e62cf8ad
bpo-30078: Add an example of passing a path to unittest ( #1178 )
2017-04-20 06:46:59 +03:00
Serhiy Storchaka
55fe1ae970
bpo-30022: Get rid of using EnvironmentError and IOError (except test… ( #1051 )
2017-04-16 10:46:38 +03:00
Victor Stinner
bbd3cf8f1e
Fix ref cycles in TestCase.assertRaises() ( #193 )
...
bpo-23890: unittest.TestCase.assertRaises() now manually breaks a
reference cycle to not keep objects alive longer than expected.
2017-03-28 00:56:28 +02:00
Victor Stinner
d6debb24e0
bpo-29919: Remove unused imports found by pyflakes ( #137 )
...
Make also minor PEP8 coding style fixes on modified imports.
2017-03-27 16:05:26 +02:00
Berker Peksag
5aa3856b4f
bpo-28961: Address my comments from earlier code review ( #305 )
2017-02-26 15:04:11 +03:00
Arne de Laat
324c5d8ca6
bpo-28911: Clarify the behaviour of assert_called_once_with. ( #251 )
2017-02-23 15:57:25 +01:00
Serhiy Storchaka
19dea2c726
Issue #28735 : Fixed the comparison of mock.MagickMock with mock.ANY.
2017-01-21 23:17:25 +02:00
Serhiy Storchaka
a203360836
Issue #28735 : Fixed the comparison of mock.MagickMock with mock.ANY.
2017-01-21 23:15:18 +02:00
Serhiy Storchaka
362f058a89
Issue #28735 : Fixed the comparison of mock.MagickMock with mock.ANY.
2017-01-21 23:12:58 +02:00
Martin Panter
9722d7f142
Issue 29274: Merge doc fixes from 3.6
2017-01-18 12:11:42 +00:00
Martin Panter
4710935b11
Issue 29274: Merge doc fixes from 3.5
2017-01-18 12:11:12 +00:00
Martin Panter
37f183d43d
Issue #29274 : tests cases → test cases
2017-01-18 12:06:38 +00:00
Serhiy Storchaka
d9c956fb23
Issue #20804 : The unittest.mock.sentinel attributes now preserve their
...
identity when they are copied or pickled.
2017-01-11 20:13:03 +02:00
Victor Stinner
cd992bbe73
Merge 3.6
2017-01-06 18:16:07 +01:00
Victor Stinner
84b6fb0eea
Fix unittest.mock._Call: don't ignore name
...
Issue #28961 : Fix unittest.mock._Call helper: don't ignore the name parameter
anymore.
Patch written by Jiajun Huang.
2017-01-06 18:15:51 +01:00
Berker Peksag
161a4dd495
Issue #28919 : Simplify _copy_func_details() in unittest.mock
...
Patch by Jiajun Huang.
2016-12-15 05:21:44 +03:00
Gregory P. Smith
ac5084b6c7
Fixes issue28380: unittest.mock Mock autospec functions now properly support
...
assert_called, assert_not_called, and assert_called_once.
2016-10-06 14:31:23 -07:00
Berker Peksag
eadf443e9a
Issue #28303 : Merge from 3.5
2016-09-28 17:29:12 +03:00
Berker Peksag
aa5c2fdb7c
Issue #28303 : Fix grammar in unittest.__doc__, patch by Shlomi Fish
2016-09-28 17:28:41 +03:00
Berker Peksag
b3d4e7fe71
Issue #25651 : Merge from 3.5
2016-09-21 19:35:28 +03:00
Berker Peksag
16ea19fc66
Issue #25651 : Allow falsy values to be used for msg parameter of subTest()
2016-09-21 19:34:15 +03:00
Martin Panter
0be894b2f6
Issue #27895 : Spelling fixes (Contributed by Ville Skyttä).
2016-09-07 12:03:06 +00:00
R David Murray
44b548dda8
#27364 : fix "incorrect" uses of escape character in the stdlib.
...
And most of the tools.
Patch by Emanual Barry, reviewed by me, Serhiy Storchaka, and
Martin Panter.
2016-09-08 13:59:53 -04:00
Raymond Hettinger
15f44ab043
Issue #27895 : Spelling fixes (Contributed by Ville Skyttä).
2016-08-30 10:47:49 -07:00
Raymond Hettinger
f74c33ad5c
Merge
2016-08-25 21:12:16 -07:00
Raymond Hettinger
7ea386e56e
Issue 19504: Change "customise" to "customize" American spelling.
2016-08-25 21:11:50 -07:00
Gregory P. Smith
c35a32fe85
Issue #26750 : use inspect.isdatadescriptor instead of our own
...
_is_data_descriptor().
2016-08-15 23:56:32 -07:00
Gregory P. Smith
d4583d7fea
Issue #26750 : use inspect.isdatadescriptor instead of our own
...
_is_data_descriptor().
2016-08-15 23:23:40 -07:00
Gregory P. Smith
d0d24fd1ae
Issue #26750 : unittest.mock.create_autospec() now works properly for
...
subclasses of property() and other data descriptors. Removes the never
publicly used, never documented unittest.mock.DescriptorTypes tuple.
2016-08-07 09:06:27 -07:00
Gregory P. Smith
9854789efe
Issue #26750 : unittest.mock.create_autospec() now works properly
...
for subclasses of property() and other data descriptors.
2016-08-07 08:52:26 -07:00
Martin Panter
8bde911115
Issue #27626 : Merge spelling fixes from 3.5
2016-07-28 01:30:58 +00:00
Martin Panter
eb9957065a
Issue #27626 : Spelling fixes in docs, comments and internal names
...
Based on patch by Ville Skyttä.
2016-07-28 01:11:04 +00:00
Martin Panter
702f4f5d6f
Issue #23804 : Merge spelling and NEWS fixes from 3.5
2016-07-11 12:54:44 +00:00
Martin Panter
204bf0b9ae
English spelling and grammar fixes
2016-07-11 07:51:37 +00:00
Berker Peksag
a9e1ebb780
Issue #27430 : Merge from 3.5
2016-07-01 12:17:45 +03:00
Berker Peksag
e39682b076
Issue #27430 : Fix typos, patch by scop.
2016-07-01 12:17:05 +03:00
Serhiy Storchaka
6c85091b5b
Issue #23641 : Added __getnewargs_ex__ to the list of special mock attributes.
2016-06-19 18:32:07 +03:00
Serhiy Storchaka
5943ea76d5
Issue #23641 : Added __getnewargs_ex__ to the list of special mock attributes.
2016-06-19 18:30:43 +03:00
Kushal Das
9cd39a170b
Issue #21271 : Adds new keyword only parameters in reset_mock call
...
We now have two keyword only parameters in the reset_mock function to
selectively reset the return_value or the side_effects, or both.
2016-06-02 10:20:16 -07:00
Martin Panter
0b7d84de6b
Issue #27171 : Merge typo fixes from 3.5
2016-06-02 10:11:18 +00:00
Martin Panter
e26da7c03a
Issue #27171 : Fix typos in documentation, comments, and test function names
2016-06-02 10:07:09 +00:00
Martin Panter
3e04d5b306
Issue #27076 : Merge spelling from 3.5
2016-05-26 06:03:19 +00:00
Martin Panter
46f50726a0
Issue #27076 : Doc, comment and tests spelling fixes
...
Most fixes to Doc/ and Lib/ directories by Ville Skyttä.
2016-05-26 05:35:26 +00:00
Serhiy Storchaka
742206d95c
Issue #27063 : Some unittest loader tests were silently skipped.
2016-05-20 23:29:07 +03:00
Serhiy Storchaka
0dad755600
Issue #27063 : Some unittest loader tests were silently skipped.
2016-05-20 23:28:37 +03:00
Robert Collins
c85dd85f1a
Issue #26807 : mock_open 'files' no longer error on readline at end of file.
...
Patch from Yolanda Robla.
2016-05-16 15:22:45 +12:00
Robert Collins
9549a3e3d4
Issue #26807 : mock_open 'files' no longer error on readline at end of file.
...
Patch from Yolanda Robla.
2016-05-16 15:22:01 +12:00
Serhiy Storchaka
81e7f94076
Merge 3.5
2016-04-25 08:58:59 +03:00
Serhiy Storchaka
685fbed7f9
Issue #26837 : assertSequenceEqual() now correctly outputs non-stringified
...
differing items (like bytes in the -b mode). This affects assertListEqual()
and assertTupleEqual().
2016-04-25 08:58:25 +03:00
Serhiy Storchaka
e437a10d15
Issue #23277 : Remove unused imports in tests.
2016-04-24 21:41:02 +03:00
Berker Peksag
1e8ee9b380
Issue #23277 : Remove unused sys and os imports
...
Patch by Jon Dufresne.
2016-04-24 07:31:42 +03:00
Victor Stinner
6e722bc13f
Merge 3.5 (test_unittest)
2016-03-30 01:15:48 +02:00
Victor Stinner
9db2ae7263
Fix ResourceWarning in test_unittest when interrupted
2016-03-30 01:15:28 +02:00
Berker Peksag
5a6c018b57
Issue #25195 : Fix a regression in mock.MagicMock
...
_Call is a subclass of tuple (changeset 3603bae63c13 only works
for classes) so we need to implement __ne__ ourselves.
Patch by Andrew Plummer.
2016-03-28 00:30:40 +03:00
Berker Peksag
ce913877e4
Issue #25195 : Fix a regression in mock.MagicMock
...
_Call is a subclass of tuple (changeset 3603bae63c13 only works
for classes) so we need to implement __ne__ ourselves.
Patch by Andrew Plummer.
2016-03-28 00:30:02 +03:00
Robert Collins
bfef0be420
#25320 : Handle sockets in directories unittest discovery is scanning.
...
Patch from Victor van den Elzen.
2016-03-15 13:33:28 +13:00
Robert Collins
ecd5383891
#25320 : Handle sockets in directories unittest discovery is scanning.
...
Patch from Victor van den Elzen.
2016-03-15 13:29:17 +13:00
Victor Stinner
2c2a4e63d7
Add Mock.assert_called()
...
Issue #26323 : Add assert_called() and assert_called_once() methods to
unittest.mock.Mock.
2016-03-11 22:17:48 +01:00
Brett Cannon
43dab4bfcf
Merge 'used with permission' additions
2016-01-15 09:54:16 -08:00
Brett Cannon
07b954d148
Add some "used with permission" mentions where external resources are referenced.
...
Permission was validated prior to adding these markings.
2016-01-15 09:53:51 -08:00
Senthil Kumaran
121edbf7e2
Issue25347 - Format the error message output of mock's assert_has_calls method.
...
Patch contributed by Robert Zimmerman.
2016-01-12 06:18:32 -08:00
Senthil Kumaran
81bc927da7
Issue #22138 : Fix mock.patch behavior when patching descriptors. Restore
...
original values after patching.
Patch contributed by Sean McCully.
2016-01-08 23:43:29 -08:00
Martin Panter
d2ad5718ad
Issue #25523 : Further a-to-an corrections new in 3.5
2015-11-02 04:20:33 +00:00
Serhiy Storchaka
153627c111
Marked keystrokes with the :kbd: role.
...
Fixed the case of the "Ctrl-" prefixes.
2015-09-12 17:46:20 +03:00
Serhiy Storchaka
0424eaf753
Marked keystrokes with the :kbd: role.
...
Fixed the case of the "Ctrl-" prefixes.
2015-09-12 17:45:25 +03:00
Berker Peksag
29bf4d403d
Issue #24857 : Comparing call_args to a long sequence now correctly returns a
...
boolean result instead of raising an exception.
Patch by A Kaptur.
2015-09-09 23:39:45 +03:00
Berker Peksag
3fc536f1c9
Issue #24857 : Comparing call_args to a long sequence now correctly returns a
...
boolean result instead of raising an exception.
Patch by A Kaptur.
2015-09-09 23:35:25 +03:00
Robert Collins
079fc7faff
Issue #21112 : Fix regression in unittest.expectedFailure on subclasses.
...
Patch from Berker Peksag.
2015-08-28 10:35:14 +12:00
Robert Collins
ed599b7c84
Issue #21112 : Fix regression in unittest.expectedFailure on subclasses.
...
Patch from Berker Peksag.
2015-08-28 10:34:51 +12:00
Robert Collins
be6caca534
Issue #20362 : Honour TestCase.longMessage correctly in assertRegex.
...
Patch from Ilia Kurenkov.
2015-08-20 11:13:09 +12:00
Berker Peksag
86b34da5ef
Issue #23004 : mock_open() now reads binary data correctly when the type of read_data is bytes.
...
Initial patch by Aaron Hill.
2015-08-06 13:15:51 +03:00