[Checkins] [zopefoundation/zope.testrunner] ad054c: Add test buffering, enabled by default for subunit

Colin Watson noreply at github.com
Thu Oct 17 13:29:34 CEST 2019


  Branch: refs/heads/master
  Home:   https://github.com/zopefoundation/zope.testrunner
  Commit: ad054c8447b0875c14df5703ef6837f54ca0dbb2
      https://github.com/zopefoundation/zope.testrunner/commit/ad054c8447b0875c14df5703ef6837f54ca0dbb2
  Author: Colin Watson <cjwatson at debian.org>
  Date:   2019-10-15 (Tue, 15 Oct 2019)

  Changed paths:
    M src/zope/testrunner/formatter.py
    M src/zope/testrunner/options.py
    M src/zope/testrunner/runner.py
    M src/zope/testrunner/tests/testrunner-errors.rst
    A src/zope/testrunner/tests/testrunner-ex/sample2/stdstreamstest.py
    M src/zope/testrunner/tests/testrunner-subunit-v2.rst
    M src/zope/testrunner/tests/testrunner-subunit.rst

  Log Message:
  -----------
  Add test buffering, enabled by default for subunit

Python 2.7 added a --buffer option to the unittest runner with the
following description:

  "The standard output and standard error streams are buffered during
  the test run.  Output during a passing test is discarded.  Output is
  echoed normally on test fail or error and is added to the failure
  messages."

Add a matching option to zope.testrunner.

This is important for subunit output: tests that output extra things to
stdout may corrupt the subunit stream (especially with v1).  This option
is therefore always enabled for --subunit and --subunit-v2.

This is based loosely on work by Graham Binns, Benji York, and Brad
Crittenden in Launchpad's zope.testing fork; but I took a different
approach that's much closer to how modern unittest works, and I haven't
yet bothered trying to buffer output from layers (on the assumption that
there will be many fewer layers than tests, making it much easier to fix
them individually to be quiet).


  Commit: 87fdbdb5a103c679b0aae61959821675db5f8fd0
      https://github.com/zopefoundation/zope.testrunner/commit/87fdbdb5a103c679b0aae61959821675db5f8fd0
  Author: Colin Watson <cjwatson at debian.org>
  Date:   2019-10-16 (Wed, 16 Oct 2019)

  Changed paths:
    M src/zope/testrunner/runner.py

  Log Message:
  -----------
  Ensure that streams are restored after testTearDown


  Commit: 855652f88b39650b9813c65c5d382ac7b9da504a
      https://github.com/zopefoundation/zope.testrunner/commit/855652f88b39650b9813c65c5d382ac7b9da504a
  Author: Colin Watson <cjwatson at debian.org>
  Date:   2019-10-17 (Thu, 17 Oct 2019)

  Changed paths:
    M src/zope/testrunner/formatter.py
    M src/zope/testrunner/tests/testrunner-errors.rst

  Log Message:
  -----------
  Tidy up buffered output a little


  Commit: f021709127e121e7c6537529eb3c9b7c5419e756
      https://github.com/zopefoundation/zope.testrunner/commit/f021709127e121e7c6537529eb3c9b7c5419e756
  Author: Colin Watson <cjwatson at debian.org>
  Date:   2019-10-17 (Thu, 17 Oct 2019)

  Changed paths:
    M src/zope/testrunner/runner.py
    M src/zope/testrunner/tests/testrunner-errors.rst

  Log Message:
  -----------
  Leave testSetUp and testTearDown unbuffered

testSetUp is called before self.options.output.start_test, so setting up
buffering at that stage eats dots under -v, test output under -vv, and
so on.  For symmetry, output from testSetUp and testTearDown should be
treated the same way, so leave both of them unbuffered.

This isn't ideal, because output from testSetUp or testTearDown might
corrupt subunit streams.  But since there are typically many fewer
layers than tests, the same argument as for layer setUp and tearDown
methods applies: it's easier to fix a small number of layers to be quiet
than to suppress output from a large number of tests.


  Commit: ff8db6eb718c3cfa3d499e7aa823459a90cc9f0f
      https://github.com/zopefoundation/zope.testrunner/commit/ff8db6eb718c3cfa3d499e7aa823459a90cc9f0f
  Author: Colin Watson <cjwatson at ubuntu.com>
  Date:   2019-10-17 (Thu, 17 Oct 2019)

  Changed paths:
    M src/zope/testrunner/formatter.py
    M src/zope/testrunner/options.py
    M src/zope/testrunner/runner.py
    M src/zope/testrunner/tests/testrunner-errors.rst
    A src/zope/testrunner/tests/testrunner-ex/sample2/stdstreamstest.py
    M src/zope/testrunner/tests/testrunner-subunit-v2.rst
    M src/zope/testrunner/tests/testrunner-subunit.rst

  Log Message:
  -----------
  Merge pull request #97 from cjwatson/subunit-std-streams

Add test buffering, enabled by default for subunit


Compare: https://github.com/zopefoundation/zope.testrunner/compare/105173bbcb26...ff8db6eb718c


More information about the checkins mailing list