Fix #1585: Output tests fail sporadically

Wait on a breakpoint before checking output.

Add temp workaround for #1574: Flask tests fail with "no such option: --wait" on windows py27

Pin Flask version to last known good one in tests/requirements.txt.

Other fixes and improvements:

Make start_method mandatory for debug.Session to avoid problems with tests forgetting to specify it.

Add debug_me.scratchpad to enable async communication between test code and debuggee.

Improve debug.Session logging.

Improve test_attach.
This commit is contained in:
Pavel Minaev 2019-07-14 00:52:08 -07:00 committed by Pavel Minaev
parent edd5753d7e
commit 4cd1d4163f
24 changed files with 285 additions and 274 deletions

View file

@ -1,32 +1,29 @@
from debug_me import backchannel, ptvsd
from debug_me import backchannel, ptvsd, scratchpad
import os
import time
ptvsd.enable_attach(("localhost", int(os.environ["ATTACH1_TEST_PORT"])))
host = os.getenv('PTVSD_TEST_HOST', 'localhost')
port = os.getenv('PTVSD_TEST_PORT', '5678')
ptvsd.enable_attach((host, port))
if os.getenv('PTVSD_WAIT_FOR_ATTACH', None) is not None:
backchannel.send('wait_for_attach')
if int(os.environ["ATTACH1_WAIT_FOR_ATTACH"]):
backchannel.send("wait_for_attach")
ptvsd.wait_for_attach()
if os.getenv('PTVSD_IS_ATTACHED', None) is not None:
backchannel.send('is_attached')
if int(os.environ["ATTACH1_IS_ATTACHED"]):
backchannel.send("is_attached")
while not ptvsd.is_attached():
print("looping until is_attached")
time.sleep(0.1)
pause_test = True
if os.getenv('PTVSD_BREAK_INTO_DBG', None) is not None:
backchannel.send('break_into_debugger')
pause_test = False
if pause_test:
backchannel.wait_for('pause_test')
for _ in range(0, 20):
time.sleep(0.1)
print('looping')
else:
if int(os.environ["ATTACH1_BREAK_INTO_DEBUGGER"]):
backchannel.send("break_into_debugger?")
assert backchannel.receive() == "proceed"
ptvsd.break_into_debugger()
print('done') # @bp
print("break") # @break_into_debugger
else:
backchannel.send("loop?")
scratchpad["paused"] = False
assert backchannel.receive() == "proceed"
while not scratchpad["paused"]:
print("looping until paused")
time.sleep(0.1)