Commit Graph

213 Commits

Author SHA1 Message Date
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
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
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
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
Robert Collins ca647ef60a Issue #21750: Further fixup to be styled like other mock APIs. 2015-07-24 03:48:20 +12:00
Robert Collins 5329aaa74b Issue #21750: mock_open.read_data can now be read from each instance, as it
could in Python 3.3.
2015-07-17 20:08:45 +12:00
Robert Collins b37f43f94b - Issue #18622: unittest.mock.mock_open().reset_mock would recurse infinitely.
Patch from Nicola Palumbo and Laurent De Buyst.
2015-07-15 11:42:28 +12:00
Berker Peksag abfaecdfdd 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:16:52 +03:00
Robert Collins 88ba360c88 Issue #21750: Further fixup to be styled like other mock APIs. 2015-07-24 03:48:45 +12:00
Robert Collins 4838717b53 Issue #21750: mock_open.read_data can now be read from each instance, as it
could in Python 3.3.
2015-07-17 20:10:23 +12:00
Robert Collins 76d508b5d4 - Issue #18622: unittest.mock.mock_open().reset_mock would recurse infinitely.
Patch from Nicola Palumbo and Laurent De Buyst.
2015-07-15 11:49:43 +12:00
Robert Collins f58f88c4c7 Issue #23661: unittest.mock side_effects can now be exceptions again.
This was a regression vs Python 3.4. Patch from Ignacio Rossi
2015-07-14 13:51:40 +12:00
Serhiy Storchaka 041dd8eef1 Issue #15836: assertRaises(), assertRaisesRegex(), assertWarns() and
assertWarnsRegex() assertments now check the type of the first argument
to prevent possible user error.  Based on patch by Daniel Wagner-Hall.
2015-05-21 20:15:40 +03:00
Serhiy Storchaka e98209c2b4 Issue #24245: Eliminated senseless expect clauses that have no any effect.
Patch by Martin Panter.
2015-05-20 16:10:04 +03:00
Serhiy Storchaka df573d6ad8 Issue #24134: assertRaises(), assertRaisesRegex(), assertWarns() and
assertWarnsRegex() checks now emits a deprecation warning when callable is
None or keyword arguments except msg is passed in the context manager mode.
2015-05-16 16:29:50 +03:00
Serhiy Storchaka 24d3b7f9df Issue #24134: assertRaises(), assertRaisesRegex(), assertWarns() and
assertWarnsRegex() checks are not longer successful if the callable is None.

Added tests for assertRaises().
2015-05-06 19:14:47 +03:00
Serhiy Storchaka e130503c7b Issue #24134: assertRaises(), assertRaisesRegex(), assertWarns() and
assertWarnsRegex() checks are not longer successful if the callable is None.

Added tests for assertRaises().
2015-05-06 19:13:11 +03:00
Łukasz Langa a468db9b0b Issue #23310: Fix MagicMock's initializer to work with __methods__.
Behavior equivalent to m.configure_mock().  Patch by Kasia Jachim.
2015-04-13 23:12:42 -07:00
Łukasz Langa 5f6684efe0 Issue #23310: Fix MagicMock's initializer to work with __methods__.
Behavior equivalent to m.configure_mock().  Patch by Kasia Jachim.
2015-04-14 00:12:57 -07:00
Serhiy Storchaka a7d00c207f Reverted issue #24134 changes (except new tests). 2015-05-16 16:25:43 +03:00
Antoine Pitrou 8eef6a9ad0 Issue #22903: The fake test case created by unittest.loader when it fails importing a test module is now picklable. 2015-03-19 00:01:37 +01:00
Antoine Pitrou d833779cea Issue #22903: The fake test case created by unittest.loader when it fails importing a test module is now picklable. 2015-03-18 23:56:46 +01:00
Berker Peksag 7aaa85932c Issue #23568: Add rdivmod support to MagicMock() objects.
Patch by Håkan Lövdahl.
2015-03-15 01:57:38 +02:00
Berker Peksag a785dece57 Issue #23568: Add rdivmod support to MagicMock() objects.
Patch by Håkan Lövdahl.
2015-03-15 01:51:56 +02:00
Berker Peksag 9bd8af788d Issue #23581: Add matmul support to MagicMock.
Patch by Håkan Lövdahl.
2015-03-12 20:42:48 +02:00
Robert Collins f0c819acd0 Issue #22936: Allow showing local variables in unittest errors. 2015-03-06 13:46:35 +13:00
Antoine Pitrou 18f22989dd Issue #22894: TestCase.subTest() would cause the test suite to be stopped when in failfast mode, even in the absence of failures. 2014-11-23 15:55:11 +01:00
Antoine Pitrou b9079c81dd Issue #22894: TestCase.subTest() would cause the test suite to be stopped when in failfast mode, even in the absence of failures. 2014-11-23 15:56:41 +01:00
Robert Collins bf2bda3c97 Close #22457: Honour load_tests in the start_dir of discovery.
We were not honouring load_tests in a package/__init__.py when that was the
start_dir parameter, though we do when it is a child package. The fix required
a little care since it introduces the possibility of infinite recursion.
2014-11-05 03:09:01 +13:00
Robert Collins 659dd625b4 Close #7559: ImportError when loading a test now shown as ImportError.
Previously the ImportError was only shown if the top level containing
package failed to import, with other ImportErrors showing up as
AttributeError - hiding the real cause. As part of this,
`TestLoader.loadTestsFromNames` now captures errors to self.errors.
2014-10-30 08:27:27 +13:00