Opened 6 years ago

Closed 6 years ago

#3506 defect closed fixed (fixed)

trial leaks log observers

Reported by: exarkun Owned by:
Priority: highest Milestone:
Component: trial Keywords:
Cc: Branch:
Author: Launchpad Bug:

Description

See seeWarnings in runner.py. This observer is added repeatedly but never removed.

Change History (2)

comment:1 Changed 6 years ago by exarkun

  • Resolution set to fixed
  • Status changed from new to closed

(In [25279]) Merge flushwarnings-3487

Author: radix, itamar, exarkun
Reviewer: glyph
Fixes: #3487
Fixes: #3427
Fixes: #2820
Fixes: #3506

Introduce TestCase.flushWarnings, an API for interacting with the Python warnings
module in unit tests. By default, the default trial reporter will write warnings
emitted by tests to its output stream (no longer does the runner print them to
stdout). flushWarnings may be used to prevent this from happening in particular
tests, and its return value may be used to make assertions about what warnings have
been emitted. TestCase.assertWarns and TestCase.callDeprecated are both now
implemented in terms of this more flexible API.

The default reporter includes rudamentary support for duplicate suppression: each
warning will be reported only once per test, but if a warning is emitted by two or
more tests, it will be reported for each test (isolating tests from each other
further by making warning behavior the same regardless of what other tests have run).

There is also some support for failing tests based on warnings emitted. If the Python
warnings filters system is used to turn a warning into an exception, any test which
causes such a warning to be emitted will have an error attributed to it.

comment:2 Changed 3 years ago by <automation>

  • Owner exarkun deleted
Note: See TracTickets for help on using tickets.