Python Unit test debugging in VS code












0















I use VS code for my Python projects and we have unit tests written using Python's unittest module. I am facing a weird issue with debugging unit tests.



VSCode Version: May 2018 (1.24)

OS Version: Windows 10



Let's say I have 20 unit tests in a particular project.



I run the tests by right clicking on a unit test file and click 'Run all unit tests'
After the run is complete, the results bar displays how many tests are passed and how many are failed. (e.g. 15 passed, 5 failed).

And I can run/debug individual test because there is a small link on every unit test function for that.
If I re-run the tests from same file, then the results bar displays the twice number of tests. (e.g. 30 passed, 10 failed)

Also the links against individual test functions disappear. So I cannot run individual tests.

The only way to be able to run/debug individual tests after this is by re-launching the VS code.



Any suggestions on how to fix this?










share|improve this question























  • I would file a bug at github.com/microsoft/vscode-python if this is for the Python extension for VS Code

    – Brett Cannon
    Jul 11 '18 at 21:20











  • I added a bug! github.com/Microsoft/vscode-python/issues/2143

    – mjkool
    Jul 25 '18 at 5:53













  • I will delete the question once the bug is fixed.

    – mjkool
    Aug 4 '18 at 19:10
















0















I use VS code for my Python projects and we have unit tests written using Python's unittest module. I am facing a weird issue with debugging unit tests.



VSCode Version: May 2018 (1.24)

OS Version: Windows 10



Let's say I have 20 unit tests in a particular project.



I run the tests by right clicking on a unit test file and click 'Run all unit tests'
After the run is complete, the results bar displays how many tests are passed and how many are failed. (e.g. 15 passed, 5 failed).

And I can run/debug individual test because there is a small link on every unit test function for that.
If I re-run the tests from same file, then the results bar displays the twice number of tests. (e.g. 30 passed, 10 failed)

Also the links against individual test functions disappear. So I cannot run individual tests.

The only way to be able to run/debug individual tests after this is by re-launching the VS code.



Any suggestions on how to fix this?










share|improve this question























  • I would file a bug at github.com/microsoft/vscode-python if this is for the Python extension for VS Code

    – Brett Cannon
    Jul 11 '18 at 21:20











  • I added a bug! github.com/Microsoft/vscode-python/issues/2143

    – mjkool
    Jul 25 '18 at 5:53













  • I will delete the question once the bug is fixed.

    – mjkool
    Aug 4 '18 at 19:10














0












0








0








I use VS code for my Python projects and we have unit tests written using Python's unittest module. I am facing a weird issue with debugging unit tests.



VSCode Version: May 2018 (1.24)

OS Version: Windows 10



Let's say I have 20 unit tests in a particular project.



I run the tests by right clicking on a unit test file and click 'Run all unit tests'
After the run is complete, the results bar displays how many tests are passed and how many are failed. (e.g. 15 passed, 5 failed).

And I can run/debug individual test because there is a small link on every unit test function for that.
If I re-run the tests from same file, then the results bar displays the twice number of tests. (e.g. 30 passed, 10 failed)

Also the links against individual test functions disappear. So I cannot run individual tests.

The only way to be able to run/debug individual tests after this is by re-launching the VS code.



Any suggestions on how to fix this?










share|improve this question














I use VS code for my Python projects and we have unit tests written using Python's unittest module. I am facing a weird issue with debugging unit tests.



VSCode Version: May 2018 (1.24)

OS Version: Windows 10



Let's say I have 20 unit tests in a particular project.



I run the tests by right clicking on a unit test file and click 'Run all unit tests'
After the run is complete, the results bar displays how many tests are passed and how many are failed. (e.g. 15 passed, 5 failed).

And I can run/debug individual test because there is a small link on every unit test function for that.
If I re-run the tests from same file, then the results bar displays the twice number of tests. (e.g. 30 passed, 10 failed)

Also the links against individual test functions disappear. So I cannot run individual tests.

The only way to be able to run/debug individual tests after this is by re-launching the VS code.



Any suggestions on how to fix this?







python python-2.7 visual-studio-code






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jul 6 '18 at 17:58









mjkoolmjkool

433




433













  • I would file a bug at github.com/microsoft/vscode-python if this is for the Python extension for VS Code

    – Brett Cannon
    Jul 11 '18 at 21:20











  • I added a bug! github.com/Microsoft/vscode-python/issues/2143

    – mjkool
    Jul 25 '18 at 5:53













  • I will delete the question once the bug is fixed.

    – mjkool
    Aug 4 '18 at 19:10



















  • I would file a bug at github.com/microsoft/vscode-python if this is for the Python extension for VS Code

    – Brett Cannon
    Jul 11 '18 at 21:20











  • I added a bug! github.com/Microsoft/vscode-python/issues/2143

    – mjkool
    Jul 25 '18 at 5:53













  • I will delete the question once the bug is fixed.

    – mjkool
    Aug 4 '18 at 19:10

















I would file a bug at github.com/microsoft/vscode-python if this is for the Python extension for VS Code

– Brett Cannon
Jul 11 '18 at 21:20





I would file a bug at github.com/microsoft/vscode-python if this is for the Python extension for VS Code

– Brett Cannon
Jul 11 '18 at 21:20













I added a bug! github.com/Microsoft/vscode-python/issues/2143

– mjkool
Jul 25 '18 at 5:53







I added a bug! github.com/Microsoft/vscode-python/issues/2143

– mjkool
Jul 25 '18 at 5:53















I will delete the question once the bug is fixed.

– mjkool
Aug 4 '18 at 19:10





I will delete the question once the bug is fixed.

– mjkool
Aug 4 '18 at 19:10












2 Answers
2






active

oldest

votes


















0














If anyone is still facing issue related to Unit Test debug and Run related issue in VS Code for Linux or Windows. Please follow these two steps.




  1. Download Latest Build From VSCode Repo Download Ling It will download a .vsix file which is an official extension to be added into next release.


  2. Install the downloaded extension (.vsix) by using command code --install-extension myextension.vsix For more detail Read This How to install Click Here



I also faced a lot of issues and struggled a lot. So finally I raised an issue in the official GitHub repository. Check here Which helped me to solve the issue.






share|improve this answer































    0














    This was a bug in Python extension for VS code and it is fixed now.






    share|improve this answer























      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51215617%2fpython-unit-test-debugging-in-vs-code%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      If anyone is still facing issue related to Unit Test debug and Run related issue in VS Code for Linux or Windows. Please follow these two steps.




      1. Download Latest Build From VSCode Repo Download Ling It will download a .vsix file which is an official extension to be added into next release.


      2. Install the downloaded extension (.vsix) by using command code --install-extension myextension.vsix For more detail Read This How to install Click Here



      I also faced a lot of issues and struggled a lot. So finally I raised an issue in the official GitHub repository. Check here Which helped me to solve the issue.






      share|improve this answer




























        0














        If anyone is still facing issue related to Unit Test debug and Run related issue in VS Code for Linux or Windows. Please follow these two steps.




        1. Download Latest Build From VSCode Repo Download Ling It will download a .vsix file which is an official extension to be added into next release.


        2. Install the downloaded extension (.vsix) by using command code --install-extension myextension.vsix For more detail Read This How to install Click Here



        I also faced a lot of issues and struggled a lot. So finally I raised an issue in the official GitHub repository. Check here Which helped me to solve the issue.






        share|improve this answer


























          0












          0








          0







          If anyone is still facing issue related to Unit Test debug and Run related issue in VS Code for Linux or Windows. Please follow these two steps.




          1. Download Latest Build From VSCode Repo Download Ling It will download a .vsix file which is an official extension to be added into next release.


          2. Install the downloaded extension (.vsix) by using command code --install-extension myextension.vsix For more detail Read This How to install Click Here



          I also faced a lot of issues and struggled a lot. So finally I raised an issue in the official GitHub repository. Check here Which helped me to solve the issue.






          share|improve this answer













          If anyone is still facing issue related to Unit Test debug and Run related issue in VS Code for Linux or Windows. Please follow these two steps.




          1. Download Latest Build From VSCode Repo Download Ling It will download a .vsix file which is an official extension to be added into next release.


          2. Install the downloaded extension (.vsix) by using command code --install-extension myextension.vsix For more detail Read This How to install Click Here



          I also faced a lot of issues and struggled a lot. So finally I raised an issue in the official GitHub repository. Check here Which helped me to solve the issue.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Aug 16 '18 at 7:23









          Shailendra2014Shailendra2014

          440316




          440316

























              0














              This was a bug in Python extension for VS code and it is fixed now.






              share|improve this answer




























                0














                This was a bug in Python extension for VS code and it is fixed now.






                share|improve this answer


























                  0












                  0








                  0







                  This was a bug in Python extension for VS code and it is fixed now.






                  share|improve this answer













                  This was a bug in Python extension for VS code and it is fixed now.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Dec 31 '18 at 14:05









                  mjkoolmjkool

                  433




                  433






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51215617%2fpython-unit-test-debugging-in-vs-code%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Monofisismo

                      Angular Downloading a file using contenturl with Basic Authentication

                      Olmecas