assert that custom PDB class is used as breakpoint hook where supported

This commit is contained in:
Anthony Shaw 2018-03-22 17:40:14 +11:00
parent 3bca983a95
commit 91d99affb7
No known key found for this signature in database
GPG Key ID: AB4A19AE1CE85744
1 changed files with 11 additions and 2 deletions

View File

@ -1,8 +1,9 @@
# encoding: utf-8
from __future__ import absolute_import
from _pytest.debugging import SUPPORTS_BREAKPOINT_BUILTIN
from _pytest.debugging import SUPPORTS_BREAKPOINT_BUILTIN, pytestPDB
import pytest
import sys
import os
class TestDebugging(object):
@ -17,3 +18,11 @@ class TestDebugging(object):
assert SUPPORTS_BREAKPOINT_BUILTIN is False
if sys.version_info.major == 2 and sys.version_info.minor == 7:
assert SUPPORTS_BREAKPOINT_BUILTIN is False
@pytest.mark.skipif(sys.version_info < (3,7), reason="Requires python3.7")
def test_sys_breakpointhook(self):
"""
Test that sys.breakpointhook is set to the custom Pdb class
"""
if 'PYTHONBREAKPOINT' not in os.environ or os.environ['PYTHONBREAKPOINT'] == '':
assert isinstance(sys.breakpointhook, pytestPDB)