Commit Graph

149 Commits

Author SHA1 Message Date
Ezio Melotti 9e9af21d45 skip tests with a non-ascii cwd when the file system encoding is ascii 2010-02-20 22:34:21 +00:00
Ezio Melotti 8f6a287029 #7712: add a temp_cwd context manager to test_support and use it in regrtest to run all the tests in a temporary directory, saving the original CWD in test_support.SAVEDCWD. Thanks to Florent Xicluna who helped with the patch. 2010-02-10 21:40:33 +00:00
Brett Cannon dc84f8fbb4 Fix a typo in a docstring introduced in r77956. 2010-02-03 22:13:44 +00:00
Brett Cannon 18e4db5ebe Update a docstring to suggest using importlib.import_module instead of calling __import__ directly. 2010-02-03 22:11:54 +00:00
Ezio Melotti 469a05fe46 remove archaic functions from test_support 2010-01-24 20:48:35 +00:00
Antoine Pitrou 84ee9e257e Use a custom timeout in test_support.open_urlresource. 2009-11-01 22:02:03 +00:00
Antoine Pitrou 59c44f36e0 Issue #7222: Make thread "reaping" more reliable so that reference
leak-chasing test runs give sensible results. The previous method of
reaping threads could return successfully while some Thread objects were
still referenced. This also introduces a new private function:
:func:hread._count().
2009-10-30 17:07:08 +00:00
R. David Murray a24db67d47 Clarify error report message, and don't recommend running in verbose
mode for more information if we are already running in verbose mode.
2009-10-19 17:53:58 +00:00
Nick Coghlan f317019c07 Silence a deprecation warning by using the appropriate replacement construct 2009-10-18 10:29:10 +00:00
Nick Coghlan fd4903bf05 Move restoration of the os.environ object into the context manager where it belongs 2009-10-17 15:45:52 +00:00
Nick Coghlan 8c1ffeb614 Don't invoke reload(sys) and use StringIO objects instead of real files to capture stdin and stdout when needed (ensures all sys attributes remain unmodified after test_xmlrpc runs) 2009-10-17 15:09:41 +00:00
Nick Coghlan 7df72dcdf9 Restore original sys.path when running TTK tests 2009-10-17 14:40:54 +00:00
Benjamin Peterson 9bd39c119e put downloaded test support files in Lib/test/data instead of the cwd 2009-07-11 22:15:13 +00:00
Benjamin Peterson 5c8da86f3a convert usage of fail* to assert* 2009-06-30 22:57:08 +00:00
Antoine Pitrou 1969059327 Issue #6215: backport the 3.1 io lib 2009-06-12 20:14:08 +00:00
Benjamin Peterson 382ccdfd5b remove function import 2009-05-31 14:43:00 +00:00
Antoine Pitrou 4698d9928e Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running
regression tests in parallel, shortening the total runtime.
2009-05-31 14:20:14 +00:00
Benjamin Peterson 0db3cd6700 a useful decorator for cleaning up threads 2009-05-14 22:40:34 +00:00
Walter Dörwald 6733bed57e Make test.test_support.EnvironmentVarGuard behave like a dictionary.
All changes are mirrored to the underlying os.environ dict, but rolled back
on exit from the with block.
2009-05-01 17:35:37 +00:00
Walter Dörwald a145317be9 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().
2009-04-25 12:15:07 +00:00
Nick Coghlan 5533ff6a2e Issue 5354: Change API for import_fresh_module() to better support test_warnings use case (also fixes some bugs in the original implementation) 2009-04-22 15:26:04 +00:00
Nick Coghlan cd2e7042ae Issue 5354: Provide a standardised testing mechanism for doing fresh imports of modules, including the ability to block extension modules in order to test the pure Python fallbacks 2009-04-11 13:31:31 +00:00
R. David Murray bdeacba51b Improve test_support.import_module docstring, remove
deprecated flag from get_attribute since it isn't likely
to do anything useful.
2009-03-31 19:33:15 +00:00
R. David Murray 597ebab744 A few more test skips via import_module, and change import_module to
return the error message produced by importlib, so that if an import
in the package whose import is being wrapped is what failed the skip
message will contain the name of that module instead of the name of the
wrapped module.  Also fixed formatting of some previous comments.
2009-03-31 18:32:17 +00:00
R. David Murray 3db8a3432b Change more tests to use import_module for the modules that
should cause tests to be skipped.  Also rename import_function
to the more descriptive get_attribute and add a docstring.
2009-03-30 23:05:48 +00:00
R. David Murray 59beec326a Add import_function method to test.test_support, and modify a number of
tests that expect to be skipped if imports fail or functions don't
exist to use import_function and import_module.  The ultimate goal is
to change regrtest to not skip automatically on ImportError.  Checking
in now to make sure the buldbots don't show any errors on platforms
I can't direct test on.
2009-03-30 19:04:00 +00:00
Benjamin Peterson effa1dc709 ** is required here 2009-03-26 21:30:54 +00:00
Benjamin Peterson a9b5be0c05 must pass argument to get expected behavior ;) 2009-03-26 21:11:16 +00:00
Benjamin Peterson bec087f29d fix incorrect auto-translation of TestSkipped -> unittest.SkipTest 2009-03-26 21:10:30 +00:00
Benjamin Peterson ad57d97596 fix naming 2009-03-26 20:49:40 +00:00
Benjamin Peterson 888a39b54c remove test_support.TestSkipped and just use unittest.SkipTest 2009-03-26 20:48:25 +00:00
Benjamin Peterson c3141a6e96 add some useful utilities for skipping tests with unittest's new skipping ability
most significantly apply a modified portion of the patch from #4242 with
patches for skipping implementation details
2009-03-26 19:58:18 +00:00
Benjamin Peterson 2f6f7436aa this can be slightly less ugly 2009-03-25 21:42:51 +00:00
Benjamin Peterson 2bf74fd0ac this is better written using assertRaises 2009-03-24 03:24:56 +00:00
Benjamin Peterson 5539c78391 make bad file descriptor tests more robust 2009-01-19 17:37:42 +00:00
Nick Coghlan d2e0938362 Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon) 2008-09-11 12:11:06 +00:00
Brett Cannon 672237dc6c warnings.catch_warnings() now returns a list or None instead of the custom
WarningsRecorder object. This makes the API simpler to use as no special object
must be learned.

Closes issue 3781.
Review by Benjamin Peterson.
2008-09-09 00:49:16 +00:00
Brett Cannon 1eaf0742d8 Move test.test_support.catch_warning() to the warnings module, rename it
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.
2008-09-02 01:25:16 +00:00
Neal Norwitz e7d8be80ba Security patches from Apple: prevent int overflow when allocating memory 2008-07-31 17:17:14 +00:00
Brett Cannon cda5ce24ed Backport test.support.fcmp() from 3.0 to silence -3 warnings. 2008-07-31 03:00:53 +00:00
Benjamin Peterson 30e208d525 remove unneeded import 2008-07-22 23:44:37 +00:00
Georg Brandl 9334d02ff5 Remove duplicate entry in __all__. 2008-07-18 10:20:59 +00:00
Nick Coghlan 38469e2719 Make test.test_support.catch_warnings more robust as discussed on python-dev. Also add explicit tests for itto test_warnings. 2008-07-13 12:23:47 +00:00
Benjamin Peterson 838c7b3619 remove some __getslice__ 2008-05-27 01:18:39 +00:00
Benjamin Peterson eeb2b21ab0 add __all__ to test_support 2008-05-26 16:22:27 +00:00
Alexandre Vassalotti 445ff35d5c Fixed typo in a comment of test_support.CleanImport. 2008-05-11 07:08:12 +00:00
Alexandre Vassalotti eb83f70586 Added test framework for handling module renames.
Factored the import guard in test_py3kwarn.TestStdlibRemovals into
a context manager, namely test_support.CleanImport.
2008-05-11 07:06:04 +00:00
Brett Cannon edb628f241 Suppress deprecations for packages as well when using
test.test_support.import_module().
2008-05-10 02:54:52 +00:00
Brett Cannon 5d023c3afa Fix a bug introduced by the addition of the 'record' argument to
test.test_support.catch_warning() where showwarning() was not being set
properly.
2008-05-08 20:20:24 +00:00
Brett Cannon bfb997d6a5 Make test.test_support.catch_warning() take an argument specifying if any
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.
2008-05-08 19:50:51 +00:00