summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_support.py
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Concatenation on a long string breaks (SF #1526585).Armin Rigo2006-08-091-1/+20
|
* Add new utility function, reap_children(), to test_support. This shouldNeal Norwitz2006-06-291-0/+21
| | | | | | | | | | be called at the end of each test that spawns children (perhaps it should be called from regrtest instead?). This will hopefully prevent some of the unexplained failures in the buildbots (hppa and alpha) during tests that spawn children. The problems were not reproducible. There were many zombies that remained at the end of several tests. In the worst case, this shouldn't cause any more problems, though it may not help either. Time will tell.
* Whitespace normalization.Tim Peters2006-06-191-1/+0
|
* Prevent spurious leaks when running regrtest.py -R. There may be moreNeal Norwitz2006-06-181-0/+23
| | | | | | | | issues that crop up from time to time, but this change seems to have been pretty stable (no spurious warnings) for about a week. Other modules which use threads may require similar use of threading_setup/threading_cleanup from test_support.
* Fix the socket tests so they can be run concurrently. Backport candidateNeal Norwitz2006-06-121-0/+18
|
* Bug #1473625: stop cPickle making float dumps locale dependent in protocol 0.Georg Brandl2006-04-301-0/+36
| | | | | On the way, add a decorator to test_support to facilitate running single test functions in different locales with automatic cleanup.
* Do the small-memory run of big-meormy tests using a prime number, ratherThomas Wouters2006-04-271-1/+1
| | | | | than a convenient power-of-2-and-multiple-of-5, so incorrect testing algorithms fail more easily.
* Whitespace normalization.Tim Peters2006-04-261-1/+1
|
* The result of SF patch #1471578: big-memory tests for strings, lists andThomas Wouters2006-04-261-1/+69
| | | | | | tuples. Lots to be added, still, but this will give big-memory people something to play with in 2.5 alpha 2, and hopefully get more people to write these tests.
* Convenience function to remove a possibly non-existant fileNeal Norwitz2006-01-231-14/+10
|