forked from microsoft/debugpy
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sourceReference should be 0 for jupyter cells. Fixes microsoft#113
- Loading branch information
Showing
12 changed files
with
184 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...debugpy/_vendored/pydevd/tests_python/resources/_debugger_case_linecache_existing_file.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import linecache | ||
import sys | ||
import os | ||
sys.path.append(os.path.dirname(os.path.abspath(__file__))) | ||
|
||
import _debugger_case_stepping | ||
|
||
linecache.updatecache(_debugger_case_stepping.__file__) | ||
assert linecache.getline(_debugger_case_stepping.__file__, 1) | ||
_debugger_case_stepping.Call() | ||
|
||
print('TEST SUCEEDED') |
57 changes: 57 additions & 0 deletions
57
...py/_vendored/pydevd/tests_python/resources/_debugger_case_source_mapping_and_reference.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
def full_function(): | ||
# Note that this function is not called, it's there just to make the mapping explicit. | ||
a = 1 # map to cell1, line 2 | ||
b = 2 # map to cell1, line 3 | ||
|
||
c = 3 # map to cell2, line 2 | ||
d = 4 # map to cell2, line 3 | ||
|
||
|
||
def create_code(): | ||
cell1_code = compile(''' # line 1 | ||
a = 1 # line 2 | ||
b = 2 # line 3 | ||
''', '<cell1>', 'exec') | ||
|
||
cell2_code = compile('''# line 1 | ||
c = 3 # line 2 | ||
d = 4 # line 3 | ||
''', '<cell2>', 'exec') | ||
|
||
# Set up the source in linecache. Python doesn't have a public API for | ||
# this, so we have to hack around it, similar to what IPython does. | ||
import linecache | ||
import time | ||
code = ''' # line 1 | ||
a = 1 # line 2 | ||
b = 2 # line 3 | ||
''' | ||
linecache.cache['<cell1>'] = ( | ||
len(code), | ||
time.time(), | ||
[line + '\n' for line in code.splitlines()], | ||
'<cell1>', | ||
) | ||
|
||
code = '''# line 1 | ||
c = 3 # line 2 | ||
d = 4 # line 3 | ||
''' | ||
linecache.cache['<cell2>'] = ( | ||
len(code), | ||
time.time(), | ||
[line + '\n' for line in code.splitlines()], | ||
'<cell2>', | ||
) | ||
|
||
return {'cell1': cell1_code, 'cell2': cell2_code} | ||
|
||
|
||
if __name__ == '__main__': | ||
code = create_code() | ||
exec(code['cell1']) | ||
exec(code['cell1']) | ||
|
||
exec(code['cell2']) | ||
exec(code['cell2']) | ||
print('TEST SUCEEDED') |
Oops, something went wrong.