Skip to content

pytest --pdb execute test cases which otherwise are skipped #2137

Closed

Description

@gst

Hi,

using pytest 3.0.5 (and xdist (1.15) + cov plugins (2.3.1)), under linux :

reproduce steps :

18:58 $ cat test_pytest_pdb_skip.py

import platform

import unittest2 as unittest


@unittest.skipIf(platform.system() != 'Windows', 'This test need to be run on Windows!')
class MyTestCase(unittest.TestCase):

    def test_one(self):
        self.assertTrue(False)

this is ok :
pytest -xv test_pytest_pdb_skip.py

this is not ok : the test is executed and here obviously fail
pytest --pdb -xv test_pytest_pdb_skip.py

Activity

  1. nicoddemus commented on Dec 14, 2016

    @nicoddemus
    Member

    Thanks for the report!

    This is a side effect of #1890, because now the skip machinery for unittest.TestCase tests is not reached when --pdb is given in the command line (unittest.py:155):

        def runtest(self):
            if self.config.pluginmanager.get_plugin("pdbinvoke") is None:
                self._testcase(result=self)
            else:
                # disables tearDown and cleanups for post mortem debugging (see #1890)
                self._testcase.debug()

    Have to think about a proper fix for this, we probably need to handle other types of failures as well (such as unexpectedSuccess). Perhaps @mbyt can chime in?

  2. added a commit that references this issue on Jan 31, 2017
    d1c7250
  3. mbyt commented on Jan 31, 2017

    @mbyt
    Contributor

    Thanks for reporting - and yes, that's definitely a regression.

    @nicoddemus, sorry for being late. I looked into this and proposed a possible solution in #2225.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    plugin: unittestrelated to the unittest integration builtin plugin

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions