From 5a53b9aabb296f18b77edabb6b873195c27ebd34 Mon Sep 17 00:00:00 2001 From: Anthony Shaw Date: Thu, 22 Mar 2018 20:40:35 +1100 Subject: [PATCH] move tests to test_pdb --- testing/test_debugging.py | 28 ---------------------------- testing/test_pdb.py | 25 +++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 28 deletions(-) delete mode 100644 testing/test_debugging.py diff --git a/testing/test_debugging.py b/testing/test_debugging.py deleted file mode 100644 index 0b5c8a8a9..000000000 --- a/testing/test_debugging.py +++ /dev/null @@ -1,28 +0,0 @@ -# encoding: utf-8 -from __future__ import absolute_import -from _pytest.debugging import SUPPORTS_BREAKPOINT_BUILTIN, pytestPDB -import pytest -import sys -import os - -class TestDebugging(object): - - def test_supports_breakpoint_module_global(self): - """ - 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 - if sys.version_info.major == 3 and sys.version_info.minor == 5: - 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) diff --git a/testing/test_pdb.py b/testing/test_pdb.py index 01604b633..c798be6fc 100644 --- a/testing/test_pdb.py +++ b/testing/test_pdb.py @@ -1,8 +1,10 @@ from __future__ import absolute_import, division, print_function import sys import platform +import os import _pytest._code +from _pytest.debugging import SUPPORTS_BREAKPOINT_BUILTIN, pytestPDB import pytest @@ -434,3 +436,26 @@ class TestPDB(object): child.expect('custom set_trace>') self.flush(child) + + +class TestDebuggingBreakpoints(object): + + def test_supports_breakpoint_module_global(self): + """ + 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 + if sys.version_info.major == 3 and sys.version_info.minor == 5: + 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)