Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
The library has sat for a while and consequentially no longer was working "out of the box" with VS Code. After doing some investigation, determined the following:
pytest.main
directlyThis PR updates everything VS Code. In addition to fixing the ability to run tests, it also updates the dev container configuration.
Note that there is no solution to the test process issue. I noticed that when a test that starts the daemon runs, there's actually two processes that persist, the parent client and the child daemon. However, I noticed that killing the client didn't satisfy VS Code, and it was only satisfied if the daemon was killed as well. Having the tests hang is a bad experience, so I added a parameter for automatically starting the daemon, and now the client will simply error if the server is not running. I plan on raising this issue with the VS Code Python maintainers to see if there's a way we can get these two to cooperate. You can bypass the new logic in VS Code by adding
"python.experiments.optOutFrom": [ "pythonTestAdapter" ]
to your config.While double checking whether the hot reloading functionality still worked as expected, I noticed the breakpoint line numbers were no longer lining up like they used to. Jurigged had a bug where functions would have the line numbers drift versus the real ones, and a (large) monkey patch was added to correct the result of the logic. Using the latest version of the library, it appears the monkey patch is now causing the drift, possibly because the issue was fixed since I last checked. I'll investigate this and alter or remove the monkey patch in a different PR. #51 was created^ Upon investigating it looks like I may have not paid close enough attention and what I thought were breakpoints not hitting were actually it failing to get past
MegaPatch.it(...)
in the test.Dev Container Changes
Client Changes
invocation_params.dir
instead ofcwd()
for giving the current working directory to the server. I'm not sure this changes anything but it seems prudent to doinvocation_params.args
instead of logic that extracted the params from the command line parameters. This was needed because VS Code no longer was passing the test via the command line and actually I'm really glad this change was made because it cut out a bunch of complexity and lines of codeServer Changes
Plugin Changes
pytest --help
is used, then it will no longer do plugin logic. This was needed because the exception raised by the server not running was a problem.--daemon-start-if-needed
parameter with correspondingPYTEST_DAEMON_START_IF_NEEDED
environment variable