summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_support.py
Commit message (Collapse)AuthorAgeFilesLines
* - Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEEDBarry Warsaw2012-02-211-1/+11
| | | | | | environment variable, to provide an opt-in way to protect against denial of service attacks due to hash collisions within the dict and set types. Patch by David Malcolm, based on work by Victor Stinner.
* Merged revisions 78769,79049 via svnmerge fromEzio Melotti2010-08-021-8/+13
| | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r78769 | florent.xicluna | 2010-03-07 21:14:12 +0200 (Sun, 07 Mar 2010) | 2 lines Refresh the documentation for the test.test_support module. ........ r79049 | florent.xicluna | 2010-03-18 21:51:47 +0200 (Thu, 18 Mar 2010) | 2 lines #8155: Preserve backward compatibility for test_support.check_warnings(). Add regression tests. ........
* Merged revisions 78815 via svnmerge fromEzio Melotti2010-08-021-4/+4
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r78815 | florent.xicluna | 2010-03-09 21:57:01 +0200 (Tue, 09 Mar 2010) | 2 lines #7772: Fix test_py3kwarn. Now the test suite could pass with "-3" flag. ........
* Merged revisions 78758 via svnmerge fromEzio Melotti2010-08-021-9/+90
| | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r78758 | florent.xicluna | 2010-03-07 14:18:33 +0200 (Sun, 07 Mar 2010) | 4 lines Issue #7849: Now the utility ``check_warnings`` verifies if the warnings are effectively raised. A new utility ``check_py3k_warnings`` deals with py3k warnings. ........
* Revert r77730 and add back verify and vereq in case other projects use them, ↵Ezio Melotti2010-01-251-1/+25
| | | | but leave the changes in test_pprint and string_tests.
* Merged revisions 77729 via svnmerge fromEzio Melotti2010-01-241-25/+1
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r77729 | ezio.melotti | 2010-01-24 22:48:35 +0200 (Sun, 24 Jan 2010) | 1 line remove archaic functions from test_support ........
* Merged revisions 76037 via svnmerge fromAntoine Pitrou2009-11-011-3/+11
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r76037 | antoine.pitrou | 2009-11-01 23:02:03 +0100 (dim., 01 nov. 2009) | 3 lines Use a custom timeout in test_support.open_urlresource. ........
* Merged revisions 75528 via svnmerge fromR. David Murray2009-10-281-1/+3
| | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r75528 | r.david.murray | 2009-10-19 13:53:58 -0400 (Mon, 19 Oct 2009) | 4 lines Clarify error report message, and don't recommend running in verbose mode for more information if we are already running in verbose mode. ........
* Merged revisions 71875 via svnmerge fromWalter Dörwald2009-04-251-15/+17
| | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r71875 | walter.doerwald | 2009-04-25 14:15:07 +0200 (Sa, 25 Apr 2009) | 7 lines Issue #5837: Certain sequences of calls to set() and unset() for support.EnvironmentVarGuard objects restored the environment variables incorrectly on __exit__. Fix this by recording the initial value of each environment variable on the first access in set() or unset(). ........
* Merged revisions 68779 via svnmerge fromBenjamin Peterson2009-01-191-0/+12
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r68779 | benjamin.peterson | 2009-01-19 11:37:42 -0600 (Mon, 19 Jan 2009) | 1 line make bad file descriptor tests more robust ........
* Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the ↵Nick Coghlan2008-09-111-1/+24
| | | | test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
* warnings.catch_warnings() now returns a list or None instead of the customBrett Cannon2008-09-091-6/+2
| | | | | | | | WarningsRecorder object. This makes the API simpler to use as no special object must be learned. Closes issue 3781. Review by Benjamin Peterson.
* Move test.test_support.catch_warning() to the warnings module, rename itBrett Cannon2008-09-021-65/+2
| | | | | | | | | | | catch_warnings(), and clean up the API. While expanding the test suite, a bug was found where a warning about the 'line' argument to showwarning() was not letting functions with '*args' go without a warning. Closes issue 3602. Code review by Benjamin Peterson.
* Security patches from Apple: prevent int overflow when allocating memoryNeal Norwitz2008-07-311-0/+25
|
* Backport test.support.fcmp() from 3.0 to silence -3 warnings.Brett Cannon2008-07-311-5/+4
|
* remove unneeded importBenjamin Peterson2008-07-221-1/+0
|
* Remove duplicate entry in __all__.Georg Brandl2008-07-181-1/+1
|
* Make test.test_support.catch_warnings more robust as discussed on ↵Nick Coghlan2008-07-131-27/+44
| | | | python-dev. Also add explicit tests for itto test_warnings.
* remove some __getslice__Benjamin Peterson2008-05-271-5/+1
|
* add __all__ to test_supportBenjamin Peterson2008-05-261-0/+13
|
* Fixed typo in a comment of test_support.CleanImport.Alexandre Vassalotti2008-05-111-1/+1
|
* Added test framework for handling module renames.Alexandre Vassalotti2008-05-111-0/+33
| | | | | Factored the import guard in test_py3kwarn.TestStdlibRemovals into a context manager, namely test_support.CleanImport.
* Suppress deprecations for packages as well when usingBrett Cannon2008-05-101-1/+2
| | | | test.test_support.import_module().
* Fix a bug introduced by the addition of the 'record' argument toBrett Cannon2008-05-081-2/+2
| | | | | test.test_support.catch_warning() where showwarning() was not being set properly.
* Make test.test_support.catch_warning() take an argument specifying if anyBrett Cannon2008-05-081-5/+6
| | | | | | triggered warnings should be captured. This allows the context manager to be used to just prevent the internal state of the 'warnings' framework and thus allow triggered warnings to be displayed.
* The mutex module has been deprecated for removal in 3.0.Brett Cannon2008-05-081-0/+13
|
* make test_support's captured_output a bit more robust when exceptions happenBenjamin Peterson2008-04-301-2/+4
|
* spellingSkip Montanaro2008-04-131-1/+1
|
* Re-implement the 'warnings' module in C. This allows for usage of theBrett Cannon2008-04-121-9/+21
| | | | | | | | | 'warnings' code in places where it was previously not possible (e.g., the parser). It could also potentially lead to a speed-up in interpreter start-up if the C version of the code (_warnings) is imported over the use of the Python version in key places. Closes issue #1631171.
* - Issue #2550: The approach used by client/server code for obtaining portsTrent Nelson2008-04-081-25/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to listen on in network-oriented tests has been refined in an effort to facilitate running multiple instances of the entire regression test suite in parallel without issue. test_support.bind_port() has been fixed such that it will always return a unique port -- which wasn't always the case with the previous implementation, especially if socket options had been set that affected address reuse (i.e. SO_REUSEADDR, SO_REUSEPORT). The new implementation of bind_port() will actually raise an exception if it is passed an AF_INET/SOCK_STREAM socket with either the SO_REUSEADDR or SO_REUSEPORT socket option set. Furthermore, if available, bind_port() will set the SO_EXCLUSIVEADDRUSE option on the socket it's been passed. This currently only applies to Windows. This option prevents any other sockets from binding to the host/port we've bound to, thus removing the possibility of the 'non-deterministic' behaviour, as Microsoft puts it, that occurs when a second SOCK_STREAM socket binds and accepts to a host/port that's already been bound by another socket. The optional preferred port parameter to bind_port() has been removed. Under no circumstances should tests be hard coding ports! test_support.find_unused_port() has also been introduced, which will pass a temporary socket object to bind_port() in order to obtain an unused port. The temporary socket object is then closed and deleted, and the port is returned. This method should only be used for obtaining an unused port in order to pass to an external program (i.e. the -accept [port] argument to openssl's s_server mode) or as a parameter to a server-oriented class that doesn't give you direct access to the underlying socket used. Finally, test_support.HOST has been introduced, which should be used for the host argument of any relevant socket calls (i.e. bind and connect). The following tests were updated to following the new conventions: test_socket, test_smtplib, test_asyncore, test_ssl, test_httplib, test_poplib, test_ftplib, test_telnetlib, test_socketserver, test_asynchat and test_socket_ssl. It is now possible for multiple instances of the regression test suite to run in parallel without issue.
* Generalize test.test_support.test_stdout() with a base context manager so thatBrett Cannon2008-04-011-7/+11
| | | | it is easy to capture stderr if desired.
* Fix a minor typo in a docstring.Brett Cannon2008-02-251-1/+1
|
* Create a db_home directory with a unique name so multiple users canNeal Norwitz2008-02-241-0/+9
| | | | | | | | | | | | run the test simultaneously. The simplest thing I found that worked on both Windows and Unix was to use the PID. It's unique so should be sufficient. This should prevent many of the spurious failures of the automated tests since they run as different users. Also cleanup the directory consistenly in the tearDown methods. It would be nice if someone ensured that the directories are always created with a consistent name.
* Patch #2167 from calvin: Remove unused importsChristian Heimes2008-02-231-1/+0
|
* Let the O/S supply a port if none of the default ports can be used.Neal Norwitz2007-10-141-4/+12
| | | | | | | | | This should make the tests more robust at the expense of allowing tests to be sloppier by not requiring them to cleanup after themselves. (It will legitamitely help when running two test suites simultaneously or if another process is already using one of the predefined ports.) Also simplifies (slightLy) the exception handling elsewhere.
* Port test_frozen to unittest.Georg Brandl2007-08-241-0/+16
|
* Remove test.test_support.guard_warnings_filter.Brett Cannon2007-08-141-8/+0
| | | | | | | | test.test_support.catch_warning is more full-featured and provides the same functionality. Since guard_warnings_filter was added in 2.6 there is no backwards-compatibility issues.
* Fix a minor typo in a docstring.Brett Cannon2007-08-141-1/+1
|
* Fix a bug in test.test_support.open_urlresource().Collin Winter2007-05-091-1/+1
| | | | | | | | | If the call to requires() doesn't precede the filesystem check, we get the following situation: 1. ./python Lib/test/regrtest.py test_foo # test needs urlfetch, not enabled, so skipped 2. ./python Lib/test/regrtest.py -u urlfetch test_foo # test runs 3. ./python Lib/test/regrtest.py test_foo # test runs (!) By moving the call to requires() *before* the filesystem check, the fact that fetched files are cached on the local disk becomes an implementation detail, rather than a semantics-changing point of note.
* Import and raise statement cleanup.Collin Winter2007-04-251-17/+9
|
* Change test_support.have_unicode to use True/False instead of 1/0.Collin Winter2007-04-251-2/+2
|
* Standardize on test.test_support.run_unittest() (as opposed to a mix of ↵Collin Winter2007-04-251-12/+11
| | | | run_unittest() and run_suite()). Also, add functionality to run_unittest() that admits usage of unittest.TestLoader.loadTestsFromModule().
* Implement a contextmanager test.test_support.catch_warning that canWalter Dörwald2007-04-031-0/+36
| | | | | | | be used to catch the last warning issued by the warning framework. Change test_warnings.py and test_structmembers.py to use this new contextmanager.
* Fix a typo where the variable name was not updated.Brett Cannon2007-03-131-1/+1
|
* Add test.test_support.transient_internet . Returns a context manager thatBrett Cannon2007-03-131-2/+13
| | | | | | | | | nests test.test_support.TransientResource context managers that capture exceptions raised when the Internet connection is flaky. Initially using in test_socket_ssl but should probably be expanded to cover any test that should not raise the captured exceptions if the Internet connection works.
* Introduce test.test_support.TransientResource. It's a context manager toBrett Cannon2007-03-081-0/+25
| | | | | | | | | | | surround calls to resources that may or may not be available. Specifying the expected exception and attributes to be raised if the resource is not available prevents overly broad catching of exceptions. This is meant to help suppress spurious failures by raising test.test_support.ResourceDenied if the exception matches. It would probably be good to go through the various network tests and surround the calls to catch connection timeouts (as done with test_socket_ssl in this commit).
* Whitespace normalization.Tim Peters2007-01-301-1/+1
|
* Add EnvironmentVarGuard to test.test_support. Provides a context manager toBrett Cannon2007-01-041-1/+33
| | | | temporarily set or unset environment variables.
* Add test.test_support.guard_warnings_filter . This function returns a contextBrett Cannon2006-12-131-0/+12
| | | | | manager that protects warnings.filter from being modified once the context is exited.
* Convert test_global, test_scope and test_grammar to unittest.Georg Brandl2006-10-281-3/+3
| | | | | I tried to enclose all tests which must be run at the toplevel (instead of inside a method) in exec statements.