(tmpdir)
| 4 | |
| 5 | @pytest.mark.skipif(sys.platform != "win32", reason="Windows-only test.") |
| 6 | def test_pydevd_api_breakpoints(tmpdir): |
| 7 | from _pydevd_bundle.pydevd_api import PyDevdAPI |
| 8 | from pydevd import PyDB |
| 9 | import pydevd_file_utils |
| 10 | |
| 11 | api = PyDevdAPI() |
| 12 | |
| 13 | py_db = PyDB(set_as_global=False) |
| 14 | |
| 15 | dira = tmpdir.join("DirA") |
| 16 | dira.mkdir() |
| 17 | |
| 18 | f = dira.join("filE.py") |
| 19 | f.write_text( |
| 20 | """ |
| 21 | a = 1 |
| 22 | b = 2 |
| 23 | c = 3 |
| 24 | """, |
| 25 | "utf-8", |
| 26 | ) |
| 27 | filename = str(f) |
| 28 | |
| 29 | result = api.add_breakpoint( |
| 30 | py_db, |
| 31 | filename, |
| 32 | breakpoint_type="python-line", |
| 33 | breakpoint_id=0, |
| 34 | line=1, |
| 35 | condition=None, |
| 36 | func_name="None", |
| 37 | expression=None, |
| 38 | suspend_policy="NONE", |
| 39 | hit_condition="", |
| 40 | is_logpoint=False, |
| 41 | ) |
| 42 | assert not result.error_code |
| 43 | |
| 44 | result = api.add_breakpoint( |
| 45 | py_db, |
| 46 | filename, |
| 47 | breakpoint_type="python-line", |
| 48 | breakpoint_id=1, |
| 49 | line=2, |
| 50 | condition=None, |
| 51 | func_name="None", |
| 52 | expression=None, |
| 53 | suspend_policy="NONE", |
| 54 | hit_condition="", |
| 55 | is_logpoint=False, |
| 56 | ) |
| 57 | assert not result.error_code |
| 58 | |
| 59 | canonical_path = pydevd_file_utils.canonical_normalized_path(filename) |
| 60 | |
| 61 | assert len(py_db.breakpoints[canonical_path]) == 2 |
| 62 | assert len(py_db.file_to_id_to_line_breakpoint[canonical_path]) == 2 |
| 63 |
nothing calls this directly
no test coverage detected