• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(255)  |  Call(254)  |  Derive(0)  |  Import(1)
Sets the unittest option flags.

The old flag is returned so that a runner could restore the old
value if it wished to:

  >>> import doctest
  >>> old = doctest._unittest_reportflags
  >>> doctest.set_unittest_reportflags(REPORT_NDIFF |
  ...                          REPORT_ONLY_FIRST_FAILURE) == old
  True

  >>> doctest._unittest_reportflags == (REPORT_NDIFF |
  ...                                   REPORT_ONLY_FIRST_FAILURE)
  True

Only reporting flags can be set:

  >>> doctest.set_unittest_reportflags(ELLIPSIS)
  Traceback (most recent call last):
  ...
  ValueError: ('Only reporting flags allowed', 8)

  >>> doctest.set_unittest_reportflags(old) == (REPORT_NDIFF |
  ...                                   REPORT_ONLY_FIRST_FAILURE)
  True

        def set_unittest_reportflags(flags):
    """Sets the unittest option flags.

    The old flag is returned so that a runner could restore the old
    value if it wished to:

      >>> import doctest
      >>> old = doctest._unittest_reportflags
      >>> doctest.set_unittest_reportflags(REPORT_NDIFF |
      ...                          REPORT_ONLY_FIRST_FAILURE) == old
      True

      >>> doctest._unittest_reportflags == (REPORT_NDIFF |
      ...                                   REPORT_ONLY_FIRST_FAILURE)
      True

    Only reporting flags can be set:

      >>> doctest.set_unittest_reportflags(ELLIPSIS)
      Traceback (most recent call last):
      ...
      ValueError: ('Only reporting flags allowed', 8)

      >>> doctest.set_unittest_reportflags(old) == (REPORT_NDIFF |
      ...                                   REPORT_ONLY_FIRST_FAILURE)
      True
    """
    global _unittest_reportflags

    if (flags & REPORTING_FLAGS) != flags:
        raise ValueError("Only reporting flags allowed", flags)
    old = _unittest_reportflags
    _unittest_reportflags = flags
    return old
        


src/z/o/zope.testing-3.10.0/src/zope/testing/doctest/__init__.py   zope.testing(Download)
## 8. Unittest Support
######################################################################
 
from doctest import set_unittest_reportflags
 
_para_re = re.compile(r'\s*\n\s*\n\s*')
def _unittest_count(docstring):