mirror of
https://github.com/microsoft/debugpy.git
synced 2025-12-23 08:48:12 +00:00
Fixes in tests, improve message regarding slow repr to note environment variable to customize it.
This commit is contained in:
parent
ac6f5ea6c9
commit
fb40a0b002
3 changed files with 30 additions and 8 deletions
|
|
@ -471,11 +471,17 @@ class Timer(object):
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
if attrs_tab_separated:
|
if attrs_tab_separated:
|
||||||
return 'pydevd warning: Computing repr of %s.%s (%s) was slow (took %.2fs)\n' % (
|
return (
|
||||||
attrs_tab_separated.replace('\t', '.'), attr_name, attr_type, diff)
|
'pydevd warning: Computing repr of %s.%s (%s) was slow (took %.2fs).\n'
|
||||||
|
'Customize report timeout by setting the `PYDEVD_WARN_SLOW_RESOLVE_TIMEOUT` environment variable to a higher timeout (default is: %ss)\n'
|
||||||
|
) % (
|
||||||
|
attrs_tab_separated.replace('\t', '.'), attr_name, attr_type, diff, PYDEVD_WARN_SLOW_RESOLVE_TIMEOUT)
|
||||||
else:
|
else:
|
||||||
return 'pydevd warning: Computing repr of %s (%s) was slow (took %.2fs)\n' % (
|
return (
|
||||||
attr_name, attr_type, diff)
|
'pydevd warning: Computing repr of %s (%s) was slow (took %.2fs)\n'
|
||||||
|
'Customize report timeout by setting the `PYDEVD_WARN_SLOW_RESOLVE_TIMEOUT` environment variable to a higher timeout (default is: %ss)\n'
|
||||||
|
) % (
|
||||||
|
attr_name, attr_type, diff, PYDEVD_WARN_SLOW_RESOLVE_TIMEOUT)
|
||||||
|
|
||||||
def report_if_getting_attr_slow(self, cls, attr_name):
|
def report_if_getting_attr_slow(self, cls, attr_name):
|
||||||
self._report_slow(self._compute_get_attr_slow, cls, attr_name)
|
self._report_slow(self._compute_get_attr_slow, cls, attr_name)
|
||||||
|
|
@ -485,7 +491,10 @@ class Timer(object):
|
||||||
cls = cls.__name__
|
cls = cls.__name__
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
return 'pydevd warning: Getting attribute %s.%s was slow (took %.2fs)\n' % (cls, attr_name, diff)
|
return (
|
||||||
|
'pydevd warning: Getting attribute %s.%s was slow (took %.2fs)\n'
|
||||||
|
'Customize report timeout by setting the `PYDEVD_WARN_SLOW_RESOLVE_TIMEOUT` environment variable to a higher timeout (default is: %ss)\n'
|
||||||
|
) % (cls, attr_name, diff, PYDEVD_WARN_SLOW_RESOLVE_TIMEOUT)
|
||||||
|
|
||||||
|
|
||||||
def import_attr_from_module(import_with_attr_access):
|
def import_attr_from_module(import_with_attr_access):
|
||||||
|
|
|
||||||
|
|
@ -952,11 +952,24 @@ def test_case_django_a(case_setup_django):
|
||||||
return env
|
return env
|
||||||
|
|
||||||
with case_setup_django.test_file(EXPECTED_RETURNCODE='any', get_environ=get_environ) as writer:
|
with case_setup_django.test_file(EXPECTED_RETURNCODE='any', get_environ=get_environ) as writer:
|
||||||
writer.write_add_breakpoint_django(5, None, 'index.html')
|
|
||||||
writer.write_make_initial_run()
|
writer.write_make_initial_run()
|
||||||
|
|
||||||
|
# Wait for the first request that works...
|
||||||
|
for i in range(4):
|
||||||
|
try:
|
||||||
|
t = writer.create_request_thread('my_app')
|
||||||
|
t.start()
|
||||||
|
contents = t.wait_for_contents()
|
||||||
|
contents = contents.replace(' ', '').replace('\r', '').replace('\n', '')
|
||||||
|
assert contents == '<ul><li>v1:v1</li><li>v2:v2</li></ul>'
|
||||||
|
break
|
||||||
|
except:
|
||||||
|
if i == 3:
|
||||||
|
raise
|
||||||
|
continue
|
||||||
|
|
||||||
|
writer.write_add_breakpoint_django(5, None, 'index.html')
|
||||||
t = writer.create_request_thread('my_app')
|
t = writer.create_request_thread('my_app')
|
||||||
time.sleep(5) # Give django some time to get to startup before requesting the page
|
|
||||||
t.start()
|
t.start()
|
||||||
|
|
||||||
hit = writer.wait_for_breakpoint_hit(REASON_STOP_ON_BREAKPOINT, line=5)
|
hit = writer.wait_for_breakpoint_hit(REASON_STOP_ON_BREAKPOINT, line=5)
|
||||||
|
|
|
||||||
|
|
@ -5425,7 +5425,7 @@ def test_debug_options(case_setup, val):
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
gui_event_loop = 'qt5'
|
gui_event_loop = 'pyside2'
|
||||||
args = dict(
|
args = dict(
|
||||||
justMyCode=val,
|
justMyCode=val,
|
||||||
redirectOutput=True, # Always redirect the output regardless of other values.
|
redirectOutput=True, # Always redirect the output regardless of other values.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue