From 91d99affb7a81d4665fe50be4f51c4eaeb340dcd Mon Sep 17 00:00:00 2001 From: Anthony Shaw Date: Thu, 22 Mar 2018 17:40:14 +1100 Subject: [PATCH] assert that custom PDB class is used as breakpoint hook where supported --- testing/test_debugging.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/testing/test_debugging.py b/testing/test_debugging.py index 9d21d0561..0b5c8a8a9 100644 --- a/testing/test_debugging.py +++ b/testing/test_debugging.py @@ -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)