summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_support.py
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
|
* Patch #1276356: Implement new resource "urlfetch" for regrtest.Hye-Shik Chang2005-12-101-0/+14
| | | | | This enables even impatient people to run tests that require remote files such as test_normalization and test_codecmaps_*.
* Build with --disable-unicode again. Fixes #1158607.Martin v. Löwis2005-03-081-1/+1
| | | | Will backport to 2.4.
* Whitespace normalization.Tim Peters2004-01-181-1/+1
|
* Typo repair; added some comments and horizontal whitespace.Tim Peters2003-12-041-9/+10
|
* Fix test_unicode_file errors on platforms without Unicode file support,Mark Hammond2003-12-031-15/+21
| | | | | by setting TESTFN_UNICODE_UNENCODEABLE on these platforms. test_unicode_file only attempts to use the name for testing if not None.
* Add TESTFN_UNICODE_UNENCODEABLE, a unicode filename that can not beMark Hammond2003-12-031-0/+21
| | | | encoded using the default file system encoding.
* Extend last change to cover TestSuites as well as TestCases.Raymond Hettinger2003-07-161-1/+1
|
* run_unittest() to support TestCase instances as well as classes. Helps with ↵Raymond Hettinger2003-07-161-1/+4
| | | | doctests.
* Include module name in doctest summary.Raymond Hettinger2003-05-171-1/+1
|
* Provide a clue that the doctests have run.Raymond Hettinger2003-05-171-1/+3
|
* Patch #734231: Update RiscOS support. In particular, correctMartin v. Löwis2003-05-101-5/+5
| | | | riscospath.extsep, and use os.extsep throughout.
* 'forget' now also deletes any proper .pyo files.Brett Cannon2003-05-041-1/+19
| | | | Added some docstrings.
* Combine the functionality of test_support.run_unittest()Walter Dörwald2003-05-011-7/+8
| | | | | | | | | | and test_support.run_classtests() into run_unittest() and use it wherever possible. Also don't use "from test.test_support import ...", but "from test import test_support" in a few spots. From SF patch #662807.
* Factor out common boilerplate for test_supportRaymond Hettinger2003-04-271-0/+6
|
* if the test is run directly (__name__ == "__main__") don't actually requireSkip Montanaro2003-04-241-0/+4
| | | | particular resources