Add more info on test failure.
@@ -7,7 +7,18 @@ from tests_python.debug_constants import IS_PY26, IS_PY3K
def test_is_main_thread():
from _pydevd_bundle.pydevd_utils import is_current_thread_main_thread
- assert is_current_thread_main_thread()
+ if not is_current_thread_main_thread() or True:
+ 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)' % (
+ threading._MainThread, current_thread.__class__.__mro__,)
+
+ raise AssertionError(error_msg)
class NonMainThread(threading.Thread):
