Skip to content

SkipTest in tearDown is reported an as an error #54066

Closed

Description

@pitrou
BPO 9857
Nosy @pitrou, @ezio-melotti, @voidspace
Files
  • python3k.skipteardown.patch: Patch against the py3k branch to add support for handling SkipTest from the tearDown method
  • python27.skipteardown.patch: Patch against the release27-maint branch to add support for handling SkipTest from the tearDown method
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/voidspace'
    closed_at = <Date 2010-12-19.03:24:16.081>
    created_at = <Date 2010-09-14.21:45:16.650>
    labels = ['type-bug', 'library']
    title = 'SkipTest in tearDown is reported an as an error'
    updated_at = <Date 2010-12-19.03:25:05.134>
    user = 'https://github.com/pitrou'

    bugs.python.org fields:

    activity = <Date 2010-12-19.03:25:05.134>
    actor = 'michael.foord'
    assignee = 'michael.foord'
    closed = True
    closed_date = <Date 2010-12-19.03:24:16.081>
    closer = 'michael.foord'
    components = ['Library (Lib)']
    creation = <Date 2010-09-14.21:45:16.650>
    creator = 'pitrou'
    dependencies = []
    files = ['19526', '19527']
    hgrepos = []
    issue_num = 9857
    keywords = ['patch']
    message_count = 6.0
    messages = ['116422', '116441', '120654', '120655', '124329', '124330']
    nosy_count = 5.0
    nosy_names = ['pitrou', 'draghuram', 'ezio.melotti', 'michael.foord', 'MarkRoddy']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue9857'
    versions = ['Python 3.2']

    Activity

    1. pitrou commented on Sep 14, 2010

      @pitrou
      MemberAuthor

      Raising SkipTest when in a tearDown method is reported as an error, rather than a skipped test.
      Now doing this sounds like a weird use case, but it would be actually useful when you have a worker thread, and the tearDown method collects the exception raised in that thread and raises it again. For the worker thread to be able to use skipTest(), a SkipTest exception raised in tearDown should be properly reported as a skip.

    2. added
      stdlib
      type-bug
      on Sep 14, 2010
    3. voidspace commented on Sep 15, 2010

      @voidspace
      Contributor

      Interesting use case.

      If the test has not yet failed this is fine. The problem is that if an exception has *already* been raised then it will already have been added to the result - so by then skipping is meaningless (or contradictory - the test can fail *and* skip).

    4. MarkRoddy commented on Nov 7, 2010

      MarkRoddymannequin
      Mannequin

      Attaching patch which adds support for registering a skip when raised from tearDown. Per Michael's point regarding failed tests, this is only handled if the test has been successful when SkipTest is raised from tearDown.

    5. MarkRoddy commented on Nov 7, 2010

      MarkRoddymannequin
      Mannequin

      Attaching patch which does the same as the previous for the release27-maint branch.

    6. voidspace commented on Dec 19, 2010

      @voidspace
      Contributor

      Committed revision 87390.

      It is a stretch to see this as a bugfix rather than a new feature so probably *shouldn't* be backported to 2.7. On the other hand the fix is combined with the fix for bpo-9857 which *is* a bugfix and *should* be backported to Python 2.7.

    7. voidspace commented on Dec 19, 2010

      @voidspace
      Contributor

      Correction, the fix is combined with the fix for bpo-10611.

    8. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    stdlibtype-bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions