-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
type: enhancementnew feature or API change, should be merged into features branchnew feature or API change, should be merged into features branch
Description
Many projects use raise unittest.SkipTest()
to skip entire test files. For example, if a file contains tests for Linux, it may be skipped on non-Linux platforms. If run with --pdb
, pytest will break at each of these raise
statements, causing needless developer delays when pytest is not intended to break at skipped tests. For larger projects, this can result in a lot of useless breakpoints and wasted developer time.
- a detailed description of the bug or problem you are having
- output of
pip list
from the virtual environment you are using - pytest and operating system versions
- minimal example if possible
user@virtual-machine:~/pytest-bug$ ls
__pycache__ test_example.py
user@virtual-machine:~/pytest-bug$ cat test_example.py
import unittest
raise unittest.SkipTest("This is skipped")
class TestExample(unittest.TestCase):
def test_example(self):
pass
user@virtual-machine:~/pytest-bug$ python3 -m pytest
================================= test session starts =================================
platform linux -- Python 3.10.6, pytest-7.1.3, pluggy-1.0.0
rootdir: /home/user/pytest-bug
collected 0 items / 1 skipped
================================= 1 skipped in 0.01s ==================================
user@virtual-machine:~/pytest-bug$ python3 -m pytest --pdb
================================= test session starts =================================
platform linux -- Python 3.10.6, pytest-7.1.3, pluggy-1.0.0
rootdir: /home/user/pytest-bug
collecting ...
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> traceback >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
('/home/user/pytest-bug/test_example.py', 3, 'unittest.case.SkipTest: This is skipped')
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> entering PDB >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> PDB post_mortem (IO-capturing turned off) >>>>>>>>>>>>>>>>>>>>>>
> /home/user/pytest-bug/test_example.py(3)<module>()
-> raise unittest.SkipTest("This is skipped")
(Pdb) c
>>>>>>>>>>>>>>>>>>>>>>>>> PDB continue (IO-capturing resumed) >>>>>>>>>>>>>>>>>>>>>>>>>
collected 0 items / 1 skipped
============================== 1 skipped in 1.58s ==============================
user@virtual-machine:~/pytest-bug$ python3 --version
Python 3.10.6
user@virtual-machine:~/pytest-bug$ python3 -m pip --version
pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)
user@virtual-machine:~/pytest-bug$ python3 -m pytest --version
pytest 7.1.3
user@virtual-machine:~/pytest-bug$ pip list
Package Version
---------------------- -------------
apturl 0.5.2
attrs 22.1.0
blinker 1.4
Brlapi 0.8.3
certifi 2020.6.20
chardet 4.0.0
click 8.0.3
colorama 0.4.4
command-not-found 0.3
cryptography 3.4.8
cupshelpers 1.0
dbus-python 1.2.18
defer 1.0.6
distro 1.7.0
distro-info 1.1build1
httplib2 0.20.2
idna 3.3
importlib-metadata 4.6.4
iniconfig 1.1.1
jeepney 0.7.1
keyring 23.5.0
language-selector 0.1
launchpadlib 1.10.16
lazr.restfulclient 0.14.4
lazr.uri 1.0.6
louis 3.20.0
macaroonbakery 1.3.1
more-itertools 8.10.0
netifaces 0.11.0
oauthlib 3.2.0
olefile 0.46
packaging 21.3
pexpect 4.8.0
Pillow 9.0.1
pip 22.0.2
pluggy 1.0.0
protobuf 3.12.4
ptyprocess 0.7.0
py 1.11.0
pycairo 1.20.1
pycups 2.0.1
PyGObject 3.42.0
PyJWT 2.3.0
pymacaroons 0.13.0
PyNaCl 1.5.0
pyparsing 2.4.7
pyRFC3339 1.1
pytest 7.1.3
python-apt 2.3.0+ubuntu2
python-dateutil 2.8.1
python-debian 0.1.43ubuntu1
pytz 2022.1
pyxdg 0.27
PyYAML 5.4.1
reportlab 3.6.8
requests 2.25.1
SecretStorage 3.3.1
setuptools 59.6.0
six 1.16.0
ssh-import-id 5.11
systemd-python 234
tomli 2.0.1
ubuntu-advantage-tools 27.7
ubuntu-drivers-common 0.0.0
ufw 0.36.1
unattended-upgrades 0.1
urllib3 1.26.5
wadllib 1.3.6
wheel 0.37.1
xdg 5
xkit 0.0.0
zipp 1.0.0
user@virtual-machine:~/pytest-bug$
Metadata
Metadata
Assignees
Labels
type: enhancementnew feature or API change, should be merged into features branchnew feature or API change, should be merged into features branch