Advice for VS Code Testing Implementation

Hello!
I am the maintainer of the vscode-python extension and had a quick question about a bug I am having which I am trying to find the best solution for.

You can see the issue which started this here: Error during Django test execution: [WinError 206] The filename or extension is too long · Issue #24242 · microsoft/vscode-python · GitHub

My main question is there any way to programmatically trigger Django test run like how pytest has pytest.main? Currently I am spinning up a subprocess to call Django test run but am hitting a limit where I am passing too many test-ids which makes the command too long. From our end I can switch to finding common parents of the tests and running those so each id doesn’t need to be included but since this is a more intensive endeavor I wanted to check to see if there are any other paths first.

I know you can call the steps of the test run itself like:

django.setup()

# Get and run the test runner
TestRunner = get_runner(settings)
....

but I am attempting to mirror user behavior as accurately as possible so doing each steps individually feels like it would restrict users control of the flow (but maybe thats not true and I should switch to this other way of calling it?)

Curious your advice as I want the Django implementation to follow the best practices of the library while working within the technical constraints of the extension.

Thanks!

1 Like