-
Notifications
You must be signed in to change notification settings - Fork 199
Return the endpoint from listen() with the in-process adapter #2051
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import pytest | ||
|
|
||
| import debugpy.server.api as _api | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def no_settrace(monkeypatch): | ||
| # Avoid actually starting pydevd; we only care about listen()'s return value. | ||
| monkeypatch.setattr(_api, "_settrace", lambda **kwargs: None) | ||
| monkeypatch.setattr(_api.listen, "called", False) | ||
|
|
||
|
|
||
| def test_listen_in_process_returns_endpoint(no_settrace): | ||
| # Regression test for #1656: listen(..., in_process_debug_adapter=True) used | ||
| # to return None, unlike the out-of-process path which returns (host, port). | ||
| endpoint = _api.listen(("127.0.0.1", 5678), in_process_debug_adapter=True) | ||
| assert endpoint == ("127.0.0.1", 5678) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The fixed-port, no-op [verified] |
||
| assert _api.listen.called is True | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
portis still the requested input value here, solisten(0, in_process_debug_adapter=True)now returns(host, 0)rather than the OS-assigned port. This does not meet the documented endpoint contract or the PR's stated port-0 motivation. Please obtain and return pydevd's bound port, or narrow the change and its description to explicitly document this limitation.[verified]