summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_warnings.py
Commit message (Collapse)AuthorAgeFilesLines
* Issue #6415: Fixed warnings.warn sagfault on bad formatted string.Hirokazu Yamamoto2009-07-171-0/+13
|
* convert usage of fail* to assert*Benjamin Peterson2009-06-301-32/+32
|
* Issue 5354: Change API for import_fresh_module() to better support ↵Nick Coghlan2009-04-221-2/+2
| | | | test_warnings use case (also fixes some bugs in the original implementation)
* Issue 5354: Provide a standardised testing mechanism for doing fresh imports ↵Nick Coghlan2009-04-111-12/+14
| | | | of modules, including the ability to block extension modules in order to test the pure Python fallbacks
* test_warnings ironically had a single test that was not protecting the warningsBrett Cannon2009-04-011-8/+8
| | | | filter and was resetting it.
* _warnings was importing itself to get an attribute. That's bad if warnings getsBrett Cannon2009-04-011-0/+35
| | | | | | called in a thread that was spawned by an import itself. Last part to close #1665206.
* Require implementations for warnings.showwarning() support the 'line' argument.Brett Cannon2009-03-111-37/+0
| | | | | | Was a DeprecationWarning for not supporting it since Python 2.6. Closes issue #3652.
* Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the ↵Nick Coghlan2008-09-111-2/+55
| | | | 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-60/+82
| | | | | | | | WarningsRecorder object. This makes the API simpler to use as no special object must be learned. Closes issue 3781. Review by Benjamin Peterson.
* Deprecate bsddb for removal in Python 3.0.Brett Cannon2008-09-051-0/+1
| | | | | Closes issue 3776. Review by Nick Coghlan.
* Move test.test_support.catch_warning() to the warnings module, rename itBrett Cannon2008-09-021-34/+40
| | | | | | | | | | | 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.
* Make test.test_support.catch_warnings more robust as discussed on ↵Nick Coghlan2008-07-131-1/+44
| | | | python-dev. Also add explicit tests for itto test_warnings.
* warnings.warn_explicit() did not have the proper TypeErrors in place to preventBrett Cannon2008-06-271-0/+15
| | | | | | | | bus errors or SystemError being raised. As a side effect of fixing this, a bad DECREF that could be triggered when 'message' and 'category' were both None was fixed. Closes issue 3211. Thanks JP Calderone for the bug report.
* Fix another "refleak" by clearing the filters after test.Georg Brandl2008-05-141-0/+1
|
* Fix logic error in Python/_warnings.c and add a test to verifyBenjamin Peterson2008-05-061-0/+9
|
* Fix a bug in the handling of the stacklevel argument in warnings.warn() whereBrett Cannon2008-05-061-0/+2
| | | | the stack was being unwound by two levels instead of one each time.
* Add a DeprecationWarning for when warnings.showwarning() is set to a functionBrett Cannon2008-05-051-0/+28
| | | | that lacks support for the new 'line' argument.
* Fix the C implementation of 'warnings' to infer the filename of the module thatBrett Cannon2008-05-031-0/+71
| | | | | | | raised an exception properly when __file__ is not set, __name__ == '__main__', and sys.argv[0] is a false value. Closes issue2743.
* Some tests did not pass on repeated calls (regrtest -R::)Amaury Forgeot d'Arc2008-04-181-0/+2
| | | | Perform additional cleanup, mostly deleting from sys.modules, or clearing the warnings registry.
* Fix spliting on colons on Windows machines with a file path by limiting theBrett Cannon2008-04-131-3/+1
| | | | number of splits.
* Add an explicit check for output in a test to try to diagnose a failure onBrett Cannon2008-04-131-1/+4
| | | | Windows.
* Fix test_warnings by making the state of things more consistent for each testBrett Cannon2008-04-131-29/+42
| | | | when it is run.
* Re-implement the 'warnings' module in C. This allows for usage of theBrett Cannon2008-04-121-75/+323
| | | | | | | | | '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.
* Add tests for the warnings module; specifically formatwarning and showwarning.Brett Cannon2007-12-201-1/+32
| | | | Still need tests for warn_explicit and simplefilter.
* Make test_warnings re-entrant.Brett Cannon2007-08-171-0/+5
|
* Remove test.test_support.guard_warnings_filter.Brett Cannon2007-08-141-1/+1
| | | | | | | | 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.
* Implement a contextmanager test.test_support.catch_warning that canWalter Dörwald2007-04-031-94/+68
| | | | | | | 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.
* Add tests for the filename.Walter Dörwald2007-04-031-0/+24
| | | | Test that the stacklevel is handled correctly.
* Document that CatchWarningTests is reused by test_structmembers.py.Walter Dörwald2007-04-031-0/+2
|
* Move the functionality for catching warnings in test_warnings.py into a separateWalter Dörwald2007-04-031-1/+3
| | | | | class to that reusing the functionality in test_structmembers.py doesn't rerun the tests from test_warnings.py.
* Whitespace normalization.Tim Peters2006-06-271-1/+1
|
* 'warning's was improperly requiring that a command-line Warning category beBrett Cannon2006-06-221-0/+13
| | | | | | | both a subclass of Warning and a subclass of types.ClassType. The latter is no longer true thanks to new-style exceptions. Closes bug #1510580. Thanks to AMK for the test.
* Make test_warnings play nice with regrtest -R:: now that regrtest doesn'tThomas Wouters2006-04-161-4/+4
| | | | | always reload the module (specifically, it doesn't reload if the module has a 'test_main'.)
* Fix tests so they pass in -R modeNeal Norwitz2006-04-091-0/+4
|
* Don't filter out OverflowWarning; should be a test failure if it is raised byBrett Cannon2006-02-271-2/+1
| | | | the interpreter in 2.5 .
* Stop producing or using OverflowWarning. PEP 237 thought this wouldTim Peters2004-08-251-0/+1
| | | | | | | happen in 2.3, but nobody noticed it still was getting generated (the warning was disabled by default). OverflowWarning and PyExc_OverflowWarning should be removed for 2.5, and left notes all over saying so.
* Reworked test_warnings.py:Raymond Hettinger2003-07-131-46/+81
| | | | | | | | | | | | | * It ran fine under "python regrtest.py test_warnings" but failed under "python regrtest.py" presumably because other tests would add to filtered warnings and not reset them at the end of the test. * Converted to a unittest format for better control. Renamed monkey() and unmonkey() to setUp() and tearDown(). * Increased coverage by testing all warnings in __builtin__. * Increased coverage by testing regex matching of specific messages.
* This test failed on WindowsME because the full file path did not getRaymond Hettinger2003-07-131-2/+2
| | | | | | reported consistently with the *nix world. 'Lib/test/test_warnings.py' came out as 'lib\test\test_warnings.py'. The basename is all we care about so I used that.
* Don't include slash in search string; it's OS-specific.Jeremy Hylton2003-07-111-1/+1
|
* Change warnings to avoid importing re module during startup.Jeremy Hylton2003-07-111-0/+53
Add API function simplefilter() that does not create or install regular expressions to match message or module. Extend the filters data structure to store None as an alternative to re.compile(""). Move the _test() function to test_warnings and add some code to try and avoid disturbing the global state of the warnings module.