summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/__init__.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-32972: Async test case (GH-13386)Andrew Svetlov2019-05-291-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add explicit `asyncSetUp` and `asyncTearDown` methods. The rest is the same as for #13228 `AsyncTestCase` create a loop instance for every test for the sake of test isolation. Sometimes a loop shared between all tests can speed up tests execution time a lot but it requires control of closed resources after every test finish. Basically, it requires nested supervisors support that was discussed with @1st1 many times. Sorry, asyncio supervisors have no chance to land on Python 3.8. The PR intentionally does not provide API for changing the used event loop or getting the test loop: use `asyncio.set_event_loop_policy()` and `asyncio.get_event_loop()` instead. The PR adds four overridable methods to base `unittest.TestCase` class: ``` def _callSetUp(self): self.setUp() def _callTestMethod(self, method): method() def _callTearDown(self): self.tearDown() def _callCleanup(self, function, /, *args, **kwargs): function(*args, **kwargs) ``` It allows using asyncio facilities with minimal influence on the unittest code. The last but not least: the PR respects contextvars. The context variable installed by `asyncSetUp` is available on test, `tearDown` and a coroutine scheduled by `addCleanup`. https://bugs.python.org/issue32972
* bpo-24412: Adds cleanUps for setUpClass and setUpModule. (GH-9190)Lisa Roach2018-11-091-3/+4
|
* Issue #28303: Fix grammar in unittest.__doc__, patch by Shlomi FishBerker Peksag2016-09-281-1/+1
|
* Add some "used with permission" mentions where external resources are ↵Brett Cannon2016-01-151-1/+1
| | | | | | referenced. Permission was validated prior to adding these markings.
* Close #22457: Honour load_tests in the start_dir of discovery.Robert Collins2014-11-041-0/+9
| | | | | | 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.
* Docstring typo fix: Arithmentic -> Arithmetic.Mark Dickinson2013-09-091-1/+1
|
* Merged revisions 80476 via svnmerge fromMichael Foord2010-04-251-2/+2
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r80476 | michael.foord | 2010-04-25 20:02:46 +0100 (Sun, 25 Apr 2010) | 1 line Adding unittest.removeHandler function / decorator for removing the signal.SIGINT signal handler. With tests and docs. ........
* Merged revisions 79437 via svnmerge fromMichael Foord2010-03-271-1/+3
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r79437 | michael.foord | 2010-03-26 03:18:31 +0000 (Fri, 26 Mar 2010) | 1 line Addition of -c command line option to unittest, to handle ctrl-c during a test run more elegantly ........
* Merged revisions 79274 via svnmerge fromBenjamin Peterson2010-03-221-2/+1
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r79274 | michael.foord | 2010-03-21 21:49:08 -0500 (Sun, 21 Mar 2010) | 1 line Correct usage message displayed for python -m unittest -h ........
* Merged revisions 79263 via svnmerge fromBenjamin Peterson2010-03-221-0/+2
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r79263 | michael.foord | 2010-03-21 19:06:30 -0500 (Sun, 21 Mar 2010) | 1 line Issue 7815. __unittest in module globals trims frames from reported stacktraces in unittest. ........
* Merged revisions 78227,78229,78288,78348,78377,78770,78774-78776,78810 via ↵Benjamin Peterson2010-03-141-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r78227 | michael.foord | 2010-02-18 14:30:09 -0600 (Thu, 18 Feb 2010) | 1 line unittest.TestCase uses safe_repr for producing failure messages. Partial fix for issue 7956 ........ r78229 | michael.foord | 2010-02-18 15:37:07 -0600 (Thu, 18 Feb 2010) | 1 line Fix unittest.TestCase.assertDictContainsSubset so it can't die with unicode issues when constructing failure messages. Issue 7956 ........ r78288 | michael.foord | 2010-02-21 08:48:59 -0600 (Sun, 21 Feb 2010) | 1 line Silence UnicodeWarning in crazy unittest test. ........ r78348 | michael.foord | 2010-02-22 17:28:32 -0600 (Mon, 22 Feb 2010) | 1 line Support for old TestResult object (unittest) with warnings when using unsupported features. ........ r78377 | michael.foord | 2010-02-23 11:00:53 -0600 (Tue, 23 Feb 2010) | 1 line unittest.TestResult can now be used with the TextTestRunner. TextTestRunner compatible with old TestResult objects. ........ r78770 | michael.foord | 2010-03-07 14:22:12 -0600 (Sun, 07 Mar 2010) | 1 line Fix for potentials errors in constructing unittest failure messages. Plus skipped test methods no longer run setUp and tearDown (Issue 8059) ........ r78774 | michael.foord | 2010-03-07 16:04:55 -0600 (Sun, 07 Mar 2010) | 1 line Addition of setUpClass and setUpModule shared fixtures to unittest. ........ r78775 | michael.foord | 2010-03-07 17:10:36 -0600 (Sun, 07 Mar 2010) | 1 line Fix accidental name rebinding in unittest py3k warning filtering. ........ r78776 | michael.foord | 2010-03-07 17:16:20 -0600 (Sun, 07 Mar 2010) | 1 line Remove accidental print statement from last commit. ........ r78810 | raymond.hettinger | 2010-03-09 02:44:18 -0600 (Tue, 09 Mar 2010) | 5 lines Improve the basic example. * Show both the decorator and regular form for assertRaises() * Use assertTrue() instead of assertIn() to teach useful minimal subset of the API ........
* Merged revisions 78158 via svnmerge fromMichael Foord2010-02-111-1/+2
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r78158 | michael.foord | 2010-02-11 14:12:07 +0000 (Thu, 11 Feb 2010) | 1 line Adding TextTestResult to unittest.__all__ ........
* Merged revisions 78130 via svnmerge fromMichael Foord2010-02-101-1/+4
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r78130 | michael.foord | 2010-02-10 14:25:12 +0000 (Wed, 10 Feb 2010) | 1 line Issue 7893 and Issue 7588 ........
* Merged revisions 77209,77229,77359-77360,77371 via svnmerge fromBenjamin Peterson2010-01-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r77209 | georg.brandl | 2010-01-01 07:07:05 -0600 (Fri, 01 Jan 2010) | 1 line More yearly updates. ........ r77229 | georg.brandl | 2010-01-02 06:35:01 -0600 (Sat, 02 Jan 2010) | 1 line Fix casing. ........ r77359 | georg.brandl | 2010-01-07 14:54:45 -0600 (Thu, 07 Jan 2010) | 1 line Fix description for Py_GetPath(); it sounded like it always returned sys.path. ........ r77360 | georg.brandl | 2010-01-07 15:48:47 -0600 (Thu, 07 Jan 2010) | 1 line #7653: clarify how the PythonPath registry key should look like. ........ r77371 | senthil.kumaran | 2010-01-08 13:20:25 -0600 (Fri, 08 Jan 2010) | 3 lines Fix for Issue7026. For the Error - RuntimeError: dictionary changed size during iteration ........
* Merged revisions 74095 via svnmerge fromBenjamin Peterson2009-07-191-0/+63
svn+ssh://pythondev@svn.python.org/python/trunk ........ r74095 | benjamin.peterson | 2009-07-19 15:18:21 -0500 (Sun, 19 Jul 2009) | 1 line split unittest.py into a package ........