Commit Graph

65 Commits

Author SHA1 Message Date
Irit Katriel 6fdfcec5b1
bpo-41943: Fix bug where assertLogs doesn't correctly filter messages… (GH-22565)
… by level

@vsajip , @pitrou

Automerge-Triggered-By: GH:vsajip
2020-11-02 11:25:29 -08:00
Kit Choi 6b34d7b51e
bpo-39385: Add an assertNoLogs context manager to unittest.TestCase (GH-18067)
Co-authored-by: Rémi Lapeyre <remi.lapeyre@henki.fr>
2020-07-01 22:08:38 +01:00
kernc 46398fba4d
bpo-29620: iterate over a copy of sys.modules (GH-4800)
unittest.TestCase.assertWarns no longer raises a RuntimeException
when accessing a module's ``__warningregistry__`` causes importation of a new
module, or when a new module is imported in another thread. 

Patch by Kernc.
2020-06-11 14:03:29 -04:00
Steve Cirelli 032de7324e
bpo-39450 Stripped whitespace before parsing the docstring in TestCase.shortDescription (GH-18175) 2020-02-03 07:06:50 +00:00
Ashwin Ramaswami f665b96e92 Fix typo in test comment (GH-11442) 2019-05-18 21:17:47 -04:00
Bruno Oliveira da2bf9f66d bpo-34900: Make TestCase.debug() work with subtests (GH-9707) 2018-10-12 13:35:55 +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
luzpaz a5293b4ff2 Fix miscellaneous typos (#4275) 2017-11-05 15:37:50 +02: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
Berker Peksag e39682b076 Issue #27430: Fix typos, patch by scop. 2016-07-01 12:17:05 +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 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 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
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
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
Robert Collins c134584020 Close #22756: Improve the test output for some assertEqual tests.
These tests were undebuggable as written, and there's no testing fallacy
involved in using the method we're testing to test the output of that method,
so switch to that.
2014-10-30 08:16:28 +13:00
Berker Peksag 1ed2e69a4a Issue #22186: Fix typos in Lib/.
Patch by Févry Thibault.
2014-10-19 18:07:05 +03:00
Berker Peksag f23530f569 Issue #22186: Fix typos in Lib/.
Patch by Févry Thibault.
2014-10-19 18:04:38 +03: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
Mark Dickinson d12290654a Fix typo in test method name. 2014-04-18 16:08:47 +01: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
R David Murray e1b6f97dae #20145: assert[Raises|Warns]Regex now raise TypeError on bad regex.
Previously a non-string, non-regex second argument could cause the test
to always pass.

Initial patch by Kamilla Holanda.
2014-03-23 15:08:43 -04: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
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
Serhiy Storchaka 77622f55c2 Issue #18996: TestCase.assertEqual() now more cleverly shorten differing
strings in error report.
2013-09-23 23:07:00 +03: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 1d7c8c9a00 Issue #19013: add unittest.main() epilogs to unittest's own test modules 2013-09-13 23:52:46 +02: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
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
Benjamin Peterson b6ffa7980f test that TestCase doesn't get cycles 2011-07-14 12:48:25 -05: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
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
Raymond Hettinger f954217458 Add direct tests for the util functions. 2010-12-24 10:30:06 +00:00
Raymond Hettinger 83961245b4 Add test for r87454. 2010-12-24 00:48:47 +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 ed3a7d2d60 #10273: Rename assertRegexpMatches and assertRaisesRegexp to assertRegex and assertRaisesRegex. 2010-12-01 02:32:32 +00:00