{"id":7103,"date":"2019-02-26T13:37:03","date_gmt":"2019-02-26T21:37:03","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/python\/?p=7103"},"modified":"2019-02-26T15:40:43","modified_gmt":"2019-02-26T23:40:43","slug":"python-in-visual-studio-code-february-2019-release","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/python\/python-in-visual-studio-code-february-2019-release\/","title":{"rendered":"Python in Visual Studio Code  &#8211; February 2019 Release"},"content":{"rendered":"<p><span style=\"font-size: 12pt\"><span style=\"color: #333333;font-family: 'Segoe UI',sans-serif\">We are pleased to announce that the February 2019 release of the Python Extension for Visual Studio Code is now available. You can\u00a0<\/span><a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-python.python\"><span style=\"color: #337ab7;font-family: 'Segoe UI',sans-serif\">download the Python extension<\/span><\/a><span style=\"color: #333333;font-family: 'Segoe UI',sans-serif\">\u00a0from the Visual Studio Marketplace, or install it directly from the extension gallery in Visual Studio Code. You can learn more about\u00a0<\/span><a href=\"https:\/\/code.visualstudio.com\/docs\/python\/python-tutorial\"><span style=\"color: #337ab7;font-family: 'Segoe UI',sans-serif\">Python support in Visual Studio Code<\/span><\/a><span style=\"color: #333333;font-family: 'Segoe UI',sans-serif\">\u00a0in the documentation.<\/span><\/span><\/p>\n<p><span style=\"font-size: 12pt\">In this release we have closed a to<\/span>tal of 40 issues, including a built-in Test Explorer, validation of breakpoint targets when debugging, and the ability to run any code selection in the Python Interactive window.<\/p>\n<p>Keep on reading to learn more!<\/p>\n<h2>Test Explorer<\/h2>\n<p>This release includes the ability to visualize, navigate and run unit tests through a test explorer, a feature that is commonly requested by our users. To access it, you can run the command<strong> Python: Discover Unit Tests<\/strong> from the Command Palette (<strong>View -&gt; Command Palette<\/strong>). If the unit test feature is disabled or no test framework is configured in the <strong>settings.json<\/strong> file, you\u2019ll be prompted to select a framework and configure it. Once tests are discovered, the Test Explorer icon will appear on the Activity Bar.<\/p>\n<p><img decoding=\"async\" class=\" wp-image-7105 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2019\/02\/TEDemoDiscoverUnitTests.gif\" alt=\"\" width=\"970\" height=\"730\" \/><\/p>\n<p>The tests files and suites are displayed in a tree view with their corresponding test methods, and can be expanded or collapsed accordingly.<\/p>\n<p><img decoding=\"async\" class=\"size-full wp-image-7106 aligncenter\" style=\"color: #52595e;font-family: Arimo,Helvetica Neue,Arial,sans-serif;font-size: 16px;font-style: normal;font-variant: normal;font-weight: 400;height: auto;letter-spacing: normal;max-width: 100%;text-align: left;text-decoration: none;text-indent: 0px;vertical-align: middle;border-style: none\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2019\/02\/2-TreeView.png\" alt=\"\" width=\"880\" height=\"612\" srcset=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2019\/02\/2-TreeView.png 880w, https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2019\/02\/2-TreeView-300x209.png 300w, https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2019\/02\/2-TreeView-768x534.png 768w\" sizes=\"(max-width: 880px) 100vw, 880px\" \/><\/p>\n<p>Through the buttons located on the top right of the test explorer, you can run all displayed tests, run the failed ones (only shown if there&#8217;s a failing test), update\/refresh the tree view, debug all tests and open the output window for the Python Test Log:<\/p>\n<p><img decoding=\"async\" class=\"size-full wp-image-7116 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2019\/02\/buttons.png\" alt=\"\" width=\"732\" height=\"97\" srcset=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2019\/02\/buttons.png 732w, https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2019\/02\/buttons-300x40.png 300w\" sizes=\"(max-width: 732px) 100vw, 732px\" \/><\/p>\n<p>You can also run and debug a single test method or all the tests from an entire file or suite through the buttons that appear when you select or hover over an item in the tree view, as well as navigate to the line of each test:<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-7118\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2019\/02\/TestExplorerUse2.gif\" alt=\"\" width=\"2480\" height=\"1488\" \/><\/p>\n<p>The test framework can also be chosen and configured by running the newly added command\u00a0Python: <strong>Configure Unit Tests<\/strong> from the Command Palette. As a reminder, the Python extension supports unit testing with Python&#8217;s built-in <a href=\"https:\/\/docs.python.org\/3\/library\/unittest.html\" target=\"_blank\" rel=\"noopener\">unittest<\/a> framework\u00a0 as well as <a href=\"https:\/\/docs.pytest.org\/en\/latest\/\" target=\"_blank\" rel=\"noopener\">pytest<\/a>. <a href=\"https:\/\/nose.readthedocs.io\/en\/latest\/\" target=\"_blank\" rel=\"noopener\">Nose<\/a> is also supported, although the framework itself is in maintenance mode.<\/p>\n<h2>Validated breakpoints when debugging<\/h2>\n<p>This release also includes an enhancement to the debugger: validation of breakpoints targets. If a breakpoint is set on a line where breakpoints are invalid (e.g. blank lines, <strong>pass<\/strong> statement, lines in the middle of a multi-line statement), then it&#8217;s automatically moved to the nearest preceeding valid line:<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-7119\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2019\/02\/DebuggerBreakpoints.gif\" alt=\"\" width=\"2480\" height=\"1488\" \/><\/p>\n<p>This way the breakpoints added are ensured to be hit. Previously the debugger would continue running past invalid breakpoints, causing confusion or wasted time.<\/p>\n<h2>Run code selection in the Python Interactive window<\/h2>\n<p>Since adding the Python Interactive window in the <a href=\"https:\/\/devblogs.microsoft.com\/python\/python-in-visual-studio-code-october-2018-release\/\">October release<\/a>, one of the top-requested features has been for the ability to run code selections without needing to define code cells. With this update, you can now send any code line\/selection to run in the Python Interactive window using command \u201cPython: Run Selection\/Line in Python Interactive window\u201d.<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-7131 size-full\" src=\"https:\/\/devblogs.microsoft.com\/python\/wp-content\/uploads\/sites\/12\/2019\/02\/shiftenter.gif\" alt=\"\" width=\"2094\" height=\"1325\" \/><\/p>\n<p>You can also use the shortcut key\u00a0<strong>Shift+Enter\u00a0<\/strong>by changing the <strong>python.dataScience.sendSelectionToInteractiveWindow<\/strong> setting to use the Python Interactive window instead of the default terminal.<\/p>\n<h2>Other Changes and Enhancements<\/h2>\n<p>We have also added small enhancements and fixed issues requested by users that should improve your experience working with Python in Visual Studio Code. The full list of improvements is listed in our\u00a0<a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/blob\/master\/CHANGELOG.md\">changelog<\/a>; some notable changes include:<\/p>\n<ul>\n<li>Add support for multi root workspaces with the new language server. (<a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/issues\/3008\">#3008<\/a>)<\/li>\n<li>Added Dutch translation (thanks <a href=\"https:\/\/github.com\/Bowero\">Robin Martijn<\/a> with the feedback of <a href=\"https:\/\/github.com\/mvantellingen\">Michael van Tellingen<\/a>) (<a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/issues\/4186\">#4186<\/a>)<\/li>\n<li>Support simple variable substitution in .env (<a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/issues\/3275\">#3275<\/a>)<\/li>\n<li>Allow &#8220;Run Cell&#8221; code lenses on non-local files. (<a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/issues\/3995\">#3995<\/a>)<\/li>\n<li>Strip comments before sending to shell command and multiline Jupyter magics work correctly. (<a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/issues\/4064\">#4064<\/a>)<\/li>\n<li>Support launch configs for debugging tests. (<a href=\"https:\/\/github.com\/Microsoft\/vscode-python\/issues\/332\">#332<\/a>)<\/li>\n<\/ul>\n<p>Be sure to\u00a0<a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-python.python\">download the Python extension<\/a>\u00a0for Visual Studio Code now to try out the above improvements. If you run into any problems, please file an issue on the\u00a0<a href=\"https:\/\/github.com\/Microsoft\/vscode-python\">Python VS Code GitHub<\/a>\u00a0page.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We are pleased to announce that the February 2019 release of the Python Extension for Visual Studio Code is now available. In this release we have closed a total of 40 issues, including a built-in Test Explorer, validation of breakpoint targets when debugging, and the ability to run any code selection in the Python Interactive window.<\/p>\n","protected":false},"author":883,"featured_media":7117,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[6],"tags":[],"class_list":["post-7103","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-visual-studio-code"],"acf":[],"blog_post_summary":"<p>We are pleased to announce that the February 2019 release of the Python Extension for Visual Studio Code is now available. In this release we have closed a total of 40 issues, including a built-in Test Explorer, validation of breakpoint targets when debugging, and the ability to run any code selection in the Python Interactive window.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/posts\/7103","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/users\/883"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/comments?post=7103"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/posts\/7103\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/media\/7117"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/media?parent=7103"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/categories?post=7103"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/tags?post=7103"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}