Disable attach_by_socket("api") for test_flask due to #1886

This commit is contained in:
Pavel Minaev 2019-10-30 15:37:16 -07:00 committed by Pavel Minaev
parent c910565b9a
commit b862bb3143
2 changed files with 22 additions and 8 deletions

View file

@ -9,7 +9,7 @@ import pytest
from ptvsd.common import compat
from tests import code, debug, log, net, test_data
from tests.debug import targets
from tests.debug import runners, targets
from tests.patterns import some
pytestmark = pytest.mark.timeout(60)
@ -20,6 +20,7 @@ flask_server = net.WebServer(net.get_test_server_port(7000, 7100))
class paths:
flask1 = test_data / "flask1"
app_py = flask1 / "app.py"
main_py = flask1 / "main.py"
hello_html = flask1 / "templates" / "hello.html"
bad_html = flask1 / "templates" / "bad.html"
@ -28,6 +29,17 @@ class lines:
app_py = code.get_marked_line_numbers(paths.app_py)
@pytest.fixture(
params=[
runners.launch["internalConsole"],
runners.launch["integratedTerminal"],
runners.attach_by_socket["cli"],
]
)
def run(request):
return request.param
@pytest.fixture
def start_flask(run):
def start(session, multiprocess=False):
@ -58,13 +70,7 @@ def start_flask(run):
# For multiproc attach, we need to use a helper stub to import debug_me
# before running Flask; otherwise, we will get the connection only from
# the subprocess, not from the Flask server process.
target = targets.Code(
code=(
"import debug_me, runpy;"
"runpy.run_module('flask', run_name='__main__')"
),
args=args,
)
target = targets.Program(paths.main_py, args=args)
else:
target = targets.Module(name="flask", args=args)

View file

@ -0,0 +1,8 @@
# For multiproc attach, we need to use a helper stub to import debug_me before running
# Flask; otherwise, we will get the connection only from the subprocess, not from the
# Flask server process.
import debug_me # noqa
import runpy
runpy.run_module("flask", run_name="__main__")