JamesHutchison / pytest-hot-reloading

A hot reloading pytest daemon, implemented as a plugin
MIT License
86 stars 2 forks source link

Updates for VS Code #50

Closed JamesHutchison closed 8 months ago

JamesHutchison commented 8 months ago

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:

This 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. https://github.com/JamesHutchison/pytest-hot-reloading/issues/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

Server Changes

Plugin Changes