From 3bca983a95d935b3c91130a1397e910fb460f338 Mon Sep 17 00:00:00 2001 From: Anthony Shaw Date: Thu, 22 Mar 2018 17:27:28 +1100 Subject: [PATCH] add a module global for whether the current runtime supports the builtin breakpoint function --- _pytest/debugging.py | 6 ++++++ testing/test_debugging.py | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/_pytest/debugging.py b/_pytest/debugging.py index 43472f23b..bb21a9e0e 100644 --- a/_pytest/debugging.py +++ b/_pytest/debugging.py @@ -4,6 +4,12 @@ import pdb import sys from doctest import UnexpectedException +try: + from builtins import breakpoint # noqa + SUPPORTS_BREAKPOINT_BUILTIN = True +except ImportError: + SUPPORTS_BREAKPOINT_BUILTIN = False + def pytest_addoption(parser): group = parser.getgroup("general") diff --git a/testing/test_debugging.py b/testing/test_debugging.py index a8b124b95..9d21d0561 100644 --- a/testing/test_debugging.py +++ b/testing/test_debugging.py @@ -8,7 +8,8 @@ class TestDebugging(object): def test_supports_breakpoint_module_global(self): """ - Test that supports breakpoint global marks on Python 3.7+ + Test that supports breakpoint global marks on Python 3.7+ and not on + CPython 3.5, 2.7 """ if sys.version_info.major == 3 and sys.version_info.minor >= 7: assert SUPPORTS_BREAKPOINT_BUILTIN is True