News

Dev Asks, and 7 Years Later Python in VS Code Delivers Django Unit Test Support

Microsoft's dev teams for coding tooling like Visual Studio Code are strictly adamant about continually seeking feedback from developers and using it to improve their respective products, though it sometimes seems to a take a long time from ask to answer.

That's the case for the main feature of the September 2024 update to Python in Visual Studio Code: Django unit test support, which comes in wildly popular extensions for Python and Jupyter, with the team also being responsible for the Pylance extension, providing a language server that delivers Python-specific "smarts." They are by far the most-used extensions for VS Code, itself a wildly popular editor topping lists in many dev tool surveys.

VS Code Python Tools in Marketplace
[Click on image for larger view.] VS Code Python Tools in Marketplace (source: Microsoft).

Way back in early 2017 a developer posted a GitHub issue saying: "Django unittest extends from unittests, but you can't run as the former on this extension. For this, you need to 'manage.py test,' but it would be awesome if there were those same shortcuts."

Just last week, in announcing the September 2024 update to Python in VS Code, Microsoft said: "We are excited to announce support for one of our most requested features: you can now discover and run Django unit tests through the Test Explorer!"

More details are provided in Django testing docs.

Another major feature highlighted by Microsoft is the enablement of inlay hints with Pylance, so devs can now more conveniently navigate to a type's definition through Ctrl+Click or Cmd+Click commands when hovering over a type.

Other changes and enhancements mostly affect the VS Code Native REPL for Python introduced in with the June release of the tools. REPL stands for Read-Eval-Print Loop, an interactive programming environment that takes user inputs (Read), evaluates them (Eval), prints the result (Print), and then loops back to wait for the next input (Loop). This cycle allows developers to write and test code snippets in real-time, making it easier to experiment and debug. The related changes include:

  • Devs can now launch the directly from the Command Palette using the Python: Start Native REPL command.
  • When using the VS Code Native REPL for Python, it will now automatically start in the project's folder.
  • Strings are now automatically normalized when commands are sent to the VS Code Native REPL.
  • It's now possible to restart the debugger while debugging tests via the debug control widget.
  • To help prioritize future work, the team is also asking for feedback on another issue: "Design proposal for test coverage" in (@vscode-python#22827). It starts out: "With the creation of the coverage API in vscode core, it is now possible to enable coverage for the python extension specifically. Below is the proposed design for how test coverage will work and includes some outstanding questions. Comments welcome as we are still in the design stage."

    The Python, Jupyter and Pylance tools for VS Code are the most downloaded in the marketplace, with the Python extension alone having been installed more than 136 million times. Pylance isn't far behind at 109 million installs, with the related Jupyter extension in third place with more than 82 million installs.

    About the Author

    David Ramel is an editor and writer for Converge360.

    comments powered by Disqus

    Featured

    • Microsoft Eases Integration with Semantic Kernel AI SDK

      The basic idea is to provide unified API abstractions, especially for idiomatic C# code, to help platform developers and others work with any provider with standard implementations for caching, telemetry, tool calling and other common tasks.

    • Final .NET 9 Preview Ships with Go-Live License

      Visual Studio developers can now download the SDK for .NET 9 Release Candidate 2 with a go-live license, meaning devs get Microsoft support for production applications even before the framework reaches general availability next month.

    • Upcycle Your Old Laptops into a Kubernetes Cluster

      Learn about Windows-to-Linux conversions and how to break and fix cloud containers -- all while helping to save the world from e-waste with some "sheer geeky fun."

    • Visual Studio's Future: Live Help to 'AI-ify Your App'

      Visual Studio guru Mads Kristensen provided a peek into the IDE's AI future, explaining how while in live-coding it will identify opportunities for your own app to use AI to your advantage.

    Subscribe on YouTube