1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
import threading
if __name__ == '__main__':
import os
import sys
port = int(sys.argv[1])
root_dirname = os.path.dirname(os.path.dirname(__file__))
if root_dirname not in sys.path:
sys.path.append(root_dirname)
def method(i):
import time
wait = True
while wait:
time.sleep(.1) # break here
threads = [threading.Thread(target=method, args=(i,)) for i in range(2)]
for t in threads:
t.start()
import pydevd
assert pydevd.get_global_debugger() is None
print('before pydevd.settrace')
pydevd.settrace(port=port)
print('after pydevd.settrace')
for t in threads:
t.join()
print('TEST SUCEEDED!')
|