зеркало из https://github.com/microsoft/debugpy.git
Sync with latest pydevd.
This commit is contained in:
Родитель
d0bb24a8ab
Коммит
609af83703
|
@ -24,7 +24,7 @@
|
|||
{
|
||||
"Component": {
|
||||
"Type": "pip",
|
||||
"pip": { "Name": "pydevd", "Version": "2.0.0" }
|
||||
"pip": { "Name": "pydevd", "Version": "2.1.0" }
|
||||
},
|
||||
"DevelopmentDependency": false
|
||||
},
|
||||
|
|
|
@ -405,7 +405,7 @@ class NetCommandFactoryJson(NetCommandFactory):
|
|||
|
||||
@overrides(NetCommandFactory.make_evaluation_timeout_msg)
|
||||
def make_evaluation_timeout_msg(self, py_db, expression, curr_thread):
|
||||
msg = '''Evaluating: %s did not finish after %.2fs seconds.
|
||||
msg = '''Evaluating: %s did not finish after %.2f seconds.
|
||||
This may mean a number of things:
|
||||
- This evaluation is really slow and this is expected.
|
||||
In this case it's possible to silence this error by raising the timeout, setting the
|
||||
|
|
|
@ -460,7 +460,7 @@ class NetCommandFactory(object):
|
|||
return NULL_NET_COMMAND # Not a part of the xml protocol
|
||||
|
||||
def make_evaluation_timeout_msg(self, py_db, expression, thread):
|
||||
msg = '''pydevd: Evaluating: %s did not finish after %.2fs seconds.
|
||||
msg = '''pydevd: Evaluating: %s did not finish after %.2f seconds.
|
||||
This may mean a number of things:
|
||||
- This evaluation is really slow and this is expected.
|
||||
In this case it's possible to silence this error by raising the timeout, setting the
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "Python.h"
|
||||
|
||||
void release_co_extra(void *obj) {
|
||||
Py_DECREF(obj);
|
||||
}
|
||||
Py_XDECREF(obj);
|
||||
}
|
||||
|
|
|
@ -211,6 +211,6 @@ dir dist
|
|||
# Note: uploading with twine gives an error in the end, but apparently it works (check final result in pypi).
|
||||
twine upload dist/pydevd*
|
||||
|
||||
git tag pydev_debugger_2_0_0 -a -m "PyDev.Debugger 2.0.0"
|
||||
git tag pydev_debugger_2_1_0 -a -m "PyDev.Debugger 2.1.0"
|
||||
git push --tags
|
||||
|
||||
|
|
|
@ -106,34 +106,6 @@ def check_no_threads():
|
|||
_start_monitoring_threads()
|
||||
|
||||
|
||||
from _pydevd_bundle.pydevd_utils import is_current_thread_main_thread
|
||||
import threading
|
||||
|
||||
|
||||
@pytest.yield_fixture(autouse=True)
|
||||
def check_main_thread(request):
|
||||
was_main = is_current_thread_main_thread()
|
||||
|
||||
yield
|
||||
|
||||
is_main = is_current_thread_main_thread()
|
||||
if not is_main:
|
||||
error_msg = 'Current thread does not seem to be a main thread. Details:\n'
|
||||
current_thread = threading.current_thread()
|
||||
error_msg += 'Current thread: %s\n' % (current_thread,)
|
||||
|
||||
if hasattr(threading, 'main_thread'):
|
||||
error_msg += 'Main thread found: %s\n' % (threading.main_thread(),)
|
||||
else:
|
||||
error_msg += 'Current main thread not instance of: %s (%s)\n' % (
|
||||
threading._MainThread, current_thread.__class__.__mro__,)
|
||||
|
||||
error_msg += 'Was main: %s\n' % (was_main,)
|
||||
error_msg += 'Function: %s\n' % (request.node.nodeid,)
|
||||
|
||||
raise AssertionError(error_msg)
|
||||
|
||||
|
||||
# see: http://goo.gl/kTQMs
|
||||
SYMBOLS = {
|
||||
'customary': ('B', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'),
|
||||
|
|
|
@ -84,7 +84,7 @@ from _pydevd_bundle.pydevd_thread_lifecycle import suspend_all_threads, mark_thr
|
|||
if USE_CUSTOM_SYS_CURRENT_FRAMES_MAP:
|
||||
from _pydevd_bundle.pydevd_constants import constructed_tid_to_last_frame
|
||||
|
||||
__version_info__ = (2, 0, 0)
|
||||
__version_info__ = (2, 1, 0)
|
||||
__version_info_str__ = []
|
||||
for v in __version_info__:
|
||||
__version_info_str__.append(str(v))
|
||||
|
|
|
@ -558,7 +558,7 @@ class DebuggerRunner(object):
|
|||
continue
|
||||
|
||||
if not shown_intermediate and (time.time() - initial_time > (TIMEOUT / 3.)): # 1/3 of timeout
|
||||
print('Warning: writer thread exited and process still did not (%.2fs seconds elapsed).' % (time.time() - initial_time,))
|
||||
print('Warning: writer thread exited and process still did not (%.2f seconds elapsed).' % (time.time() - initial_time,))
|
||||
shown_intermediate = True
|
||||
|
||||
if time.time() - initial_time > ((TIMEOUT / 3.) * 2.): # 2/3 of timeout
|
||||
|
@ -575,7 +575,7 @@ class DebuggerRunner(object):
|
|||
process.kill()
|
||||
time.sleep(.2)
|
||||
self.fail_with_message(
|
||||
"The other process should've exited but still didn't (%.2fs seconds timeout for process to exit)." % (time.time() - initial_time,),
|
||||
"The other process should've exited but still didn't (%.2f seconds timeout for process to exit)." % (time.time() - initial_time,),
|
||||
stdout, stderr, writer
|
||||
)
|
||||
time.sleep(.2)
|
||||
|
|
|
@ -2752,7 +2752,7 @@ def test_attach_to_pid_no_threads(case_setup_remote, reattach):
|
|||
writer.finished_ok = True
|
||||
|
||||
|
||||
@pytest.mark.skipif(not IS_CPYTHON, reason='CPython only test.')
|
||||
@pytest.mark.skipif(not IS_CPYTHON or IS_MAC, reason='CPython only test (brittle on Mac).')
|
||||
def test_attach_to_pid_halted(case_setup_remote):
|
||||
with case_setup_remote.test_file('_debugger_case_attach_to_pid_multiple_threads.py', wait_for_port=False) as writer:
|
||||
time.sleep(1) # Give it some time to initialize and get to the proper halting condition
|
||||
|
|
|
@ -17,7 +17,7 @@ from _pydevd_bundle._debug_adapter.pydevd_schema import (ThreadEvent, ModuleEven
|
|||
from _pydevd_bundle.pydevd_comm_constants import file_system_encoding
|
||||
from _pydevd_bundle.pydevd_constants import (int_types, IS_64BIT_PROCESS,
|
||||
PY_VERSION_STR, PY_IMPL_VERSION_STR, PY_IMPL_NAME, IS_PY36_OR_GREATER,
|
||||
IS_PYPY, GENERATED_LEN_ATTR_NAME, IS_WINDOWS, IS_LINUX)
|
||||
IS_PYPY, GENERATED_LEN_ATTR_NAME, IS_WINDOWS, IS_LINUX, IS_MAC)
|
||||
from tests_python import debugger_unittest
|
||||
from tests_python.debug_constants import TEST_CHERRYPY, IS_PY2, TEST_DJANGO, TEST_FLASK, IS_PY26, \
|
||||
IS_PY27, IS_CPYTHON, TEST_GEVENT, TEST_CYTHON
|
||||
|
@ -3958,7 +3958,7 @@ def _attach_to_writer_pid(writer):
|
|||
|
||||
|
||||
@pytest.mark.parametrize('reattach', [True, False])
|
||||
@pytest.mark.skipif(not IS_CPYTHON, reason='Attach to pid only available in CPython.')
|
||||
@pytest.mark.skipif(not IS_CPYTHON or IS_MAC, reason='Attach to pid only available in CPython (brittle on Mac).')
|
||||
def test_attach_to_pid(case_setup_remote, reattach):
|
||||
import threading
|
||||
|
||||
|
|
|
@ -26,7 +26,55 @@ def test_expression_to_evaluate():
|
|||
assert _expression_to_evaluate(u' for a in expr:\n pass') == u'for a in expr:\npass'
|
||||
|
||||
|
||||
@pytest.mark.skipif(IS_WINDOWS, reason='Brittle on Windows.')
|
||||
def test_is_main_thread():
|
||||
'''
|
||||
This is now skipped due to it failing sometimes (only on Windows).
|
||||
|
||||
I (fabioz) am not 100% sure on why this happens, but when this happens the initial thread for
|
||||
the tests seems to be a non main thread.
|
||||
|
||||
i.e.: With an autouse fixture with a scope='session' with the code and error message below, it's
|
||||
possible to see that at even at the `conftest` import (where indent_at_import is assigned) the
|
||||
current thread is already not the main thread.
|
||||
|
||||
As far as I know this seems to be an issue in how pytest-xdist is running the tests (i.e.:
|
||||
I couldn't reproduce this without running with `python -m pytest -n 0 ...`).
|
||||
|
||||
-------- Code to check error / error output ----------
|
||||
|
||||
from _pydevd_bundle.pydevd_utils import is_current_thread_main_thread
|
||||
import threading
|
||||
indent_at_import = threading.get_ident()
|
||||
|
||||
@pytest.yield_fixture(autouse=True, scope='session')
|
||||
def check_main_thread_session(request):
|
||||
if not is_current_thread_main_thread():
|
||||
error_msg = 'Current thread does not seem to be a main thread at the start of the session. Details:\n'
|
||||
current_thread = threading.current_thread()
|
||||
error_msg += 'Current thread: %s\n' % (current_thread,)
|
||||
error_msg += 'Current thread ident: %s\n' % (current_thread.ident,)
|
||||
error_msg += 'ident at import: %s\n' % (indent_at_import,)
|
||||
error_msg += 'curr ident: %s\n' % (threading.get_ident(),)
|
||||
|
||||
if hasattr(threading, 'main_thread'):
|
||||
error_msg += 'Main thread found: %s\n' % (threading.main_thread(),)
|
||||
error_msg += 'Main thread id: %s\n' % (threading.main_thread().ident,)
|
||||
else:
|
||||
error_msg += 'Current main thread not instance of: %s (%s)\n' % (
|
||||
threading._MainThread, current_thread.__class__.__mro__,)
|
||||
|
||||
> raise AssertionError(error_msg)
|
||||
E AssertionError: Current thread does not seem to be a main thread at the start of the session. Details:
|
||||
E Current thread: <_DummyThread(Dummy-2, started daemon 7072)>
|
||||
E Current thread ident: 7072
|
||||
E ident at import: 7072
|
||||
E curr ident: 7072
|
||||
E Main thread found: <_MainThread(MainThread, started 5924)>
|
||||
E Main thread id: 5924
|
||||
|
||||
conftest.py:67: AssertionError
|
||||
'''
|
||||
from _pydevd_bundle.pydevd_utils import is_current_thread_main_thread
|
||||
from _pydevd_bundle.pydevd_utils import dump_threads
|
||||
if not is_current_thread_main_thread():
|
||||
|
|
Загрузка…
Ссылка в новой задаче