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 at Converge 360.

    comments powered by Disqus

    Featured

    • Hands On: New VS Code Insiders Build Creates Web Page from Image in Seconds

      New Vision support with GitHub Copilot in the latest Visual Studio Code Insiders build takes a user-supplied mockup image and creates a web page from it in seconds, handling all the HTML and CSS.

    • Naive Bayes Regression Using C#

      Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the naive Bayes regression technique, where the goal is to predict a single numeric value. Compared to other machine learning regression techniques, naive Bayes regression is usually less accurate, but is simple, easy to implement and customize, works on both large and small datasets, is highly interpretable, and doesn't require tuning any hyperparameters.

    • VS Code Copilot Previews New GPT-4o AI Code Completion Model

      The 4o upgrade includes additional training on more than 275,000 high-quality public repositories in over 30 popular programming languages, said Microsoft-owned GitHub, which created the original "AI pair programmer" years ago.

    • Microsoft's Rust Embrace Continues with Azure SDK Beta

      "Rust's strong type system and ownership model help prevent common programming errors such as null pointer dereferencing and buffer overflows, leading to more secure and stable code."

    • Xcode IDE from Microsoft Archrival Apple Gets Copilot AI

      Just after expanding the reach of its Copilot AI coding assistant to the open-source Eclipse IDE, Microsoft showcased how it's going even further, providing details about a preview version for the Xcode IDE from archrival Apple.

    Subscribe on YouTube

    Upcoming Training Events