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: jml Owned by:
Priority: highest Milestone:
Component: trial Keywords:
Cc: Branch: branches/trial-reporter-done-2883
branch-diff, diff-cov, branch-cov, buildbot
Author: jml


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 jml

  • author set to jml
  • Branch set to branches/trial-reporter-done-2883

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

comment:2 Changed 9 years ago by jml

  • Keywords review added
  • Owner jml deleted
  • Priority changed from normal to highest

Ready, I think.

comment:3 Changed 9 years ago by exarkun

  • Owner set to exarkun
  • Status changed from new to assigned

comment:4 Changed 9 years ago by exarkun

  • Keywords review removed
  • Owner changed from exarkun to jml
  • Status changed from assigned to new
  • twisted/trial/ Some docstrings use DEPRECATED, some use Deprecated. Should be easy to pick one or the other.
  • twisted/trial/
    • 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/
    • a warning in 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 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 jml

  • Keywords review added
  • Owner changed from jml to exarkun
  • 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 exarkun

  • Keywords review removed
  • Owner changed from exarkun to jml

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 jml

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

Fixed in [21918].

comment:8 Changed 6 years ago by <automation>

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