Opened 9 years ago

Closed 9 years ago

#2883 enhancement closed fixed (fixed)

Remove attributes and methods from IReporter that imply text output

Reported by: Jonathan Lange Owned by:
Priority: highest Milestone:
Component: trial Keywords:
Cc: Branch: branches/trial-reporter-done-2883
branch-diff, diff-cov, branch-cov, buildbot
Author: jml

Description

The following methods should be removed from IReporter:

  • write
  • writeln
  • printErrors
  • printSummary

The following attributes should also be removed:

  • stream
  • separator

We should also consider removing tbformat.

These should be replaced with a single method done(). This method can then be called by a test runner to tell the reporter that the entire test suite has finished running and that it can now summarize results.

Naturally, 'remove' means 'deprecate'.

Change History (8)

comment:1 Changed 9 years ago by Jonathan Lange

author: jml
Branch: branches/trial-reporter-done-2883

(In [21849]) Branching to 'trial-reporter-done-2883'

comment:2 Changed 9 years ago by Jonathan Lange

Keywords: review added
Owner: Jonathan Lange deleted
Priority: normalhighest

Ready, I think.

comment:3 Changed 9 years ago by Jean-Paul Calderone

Owner: set to Jean-Paul Calderone
Status: newassigned

comment:4 Changed 9 years ago by Jean-Paul Calderone

Keywords: review removed
Owner: changed from Jean-Paul Calderone to Jonathan Lange
Status: assignednew
  • twisted/trial/itrial.py: Some docstrings use DEPRECATED, some use Deprecated. Should be easy to pick one or the other.
  • twisted/trial/reporter.py
    • New/modified and undocumented and not deprecated on Reporter:
      • startTime
      • startTest
      • addFailure
      • addError
      • _write
      • _writeln
      • _printResults
      • _printErrors
      • _printSummary
    • done's docstring might be improved if it were just a little bit more specific (ie, it writes the summary to its stream and the summary includes the number of tests run and how long they took)
    • MinimalReporter's _printErrors and _printSummary also changed but have no docstrings
    • Lots of methods without docstrings changed on TextReporter
    • Lots of methods without docstrings changed on VerboseTextReporter
    • TimingTextReporter.stopTest has no docstring
    • Changed methods on TreeReporter without docstrings
      • _testPrelude
      • startTest
      • endLine
  • twisted/trial/runner.py
    • a warning in TrialRunner.run for the case where done is None, pointing out that the new method should be implemented, would be helpful (ideally this would refer to the location of the definition of the type of the result, but doing that right is probably tricky enough to merit another ticket)
  • twisted/trial/test/test_runner.py
    • Test methods changed without docstrings:
      • PyunitTestNames.test_minimalReporter
      • SkipTest.test_summary
      • SkipTest.test_basicErrors
      • SkipTest.test_booleanSkip
      • SkipTest.test_exceptionSkip
    • I think the new deprecation tests really want to be indirecting the call to the deprecated methods by one level (eg, lambda: writeln() instead of writeln) and dropping the stack level down to 2. A utility or more structured way to define deprecations here would certainly be an improvement over this trick and using __file__ with assertWarns.

comment:5 Changed 9 years ago by Jonathan Lange

Keywords: review added
Owner: changed from Jonathan Lange to Jean-Paul Calderone
  • I've skipped docstrings for VerboseTextReporter and TestReporter. The methods are so similar, so short and so few that they are adequately covered by their class docstrings, interface docstrings and base-class method docstrings.

Otherwise, everything is covered, I think.

comment:6 Changed 9 years ago by Jean-Paul Calderone

Keywords: review removed
Owner: changed from Jean-Paul Calderone to Jonathan Lange

done's docstring misspells occurred as occured.

There's no test for the warning emitted if done is None. Also the stacklevel is probably irrelevant, since there's probably no interesting user-code above the call on the stack.

The rest is good, merge once the above items are fixed.

comment:7 Changed 9 years ago by Jonathan Lange

Resolution: fixed
Status: newclosed

Fixed in [21918].

comment:8 Changed 6 years ago by <automation>

Owner: Jonathan Lange deleted
Note: See TracTickets for help on using tickets.