question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SystemExit while debugging unit test method

See original GitHub issue

Environment data

  • VS Code version: 1.28.2
  • Extension version (available under the Extensions sidebar): 2018.9.2
  • OS and version: macOS Mojave 10.14
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.6.2
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): venv
  • Relevant/affected Python packages and their versions: pytest 3.6.0

Actual behavior

When I run Debug unit test method... and choosing the test to debug it opens testlauncher.py and shows this message:

Exception has occurred: SystemExit
0
  File "~/.vscode/extensions/ms-python.python-2018.9.2/pythonFiles/experimental/testlauncher.py", line 58, in run
    pass
  File "~/.vscode/extensions/ms-python.python-2018.9.2/pythonFiles/experimental/testlauncher.py", line 64, in <module>
    run(cwd, testRunner, args)

Expected behavior

Start debugging 😄

Steps to reproduce:

  1. Open command palette
  2. Run Python: Debug unit test method...
  3. Choose a method to run

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

Starting Microsoft Python language server.
##########Linting Output - pylint##########
************* Module testlauncher
23,8,error,E0611:No name 'debugger' in module 'ptvsd'
23,8,error,E0401:Unable to import 'ptvsd.debugger'
26,8,error,E1101:Class 'traceback' has no 'print_exc' member
26,8,error,E0602:Undefined variable 'traceback'
22,8,warning,W0612:Unused variable 'ptvsd'
54,12,error,E0401:Unable to import 'nose'

------------------------------------------------------------------
Your code has been rated at 1.88/10 (previous run: 1.88/10, +0.00)

Microsoft Python Language Server version 0.1.50.0
Initializing for ~/path/to/project/venv/bin/python
##########Linting Output - pylint##########

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

##########Linting Output - pylint##########
************* Module testlauncher
23,8,error,E0611:No name 'debugger' in module 'ptvsd'
23,8,error,E0401:Unable to import 'ptvsd.debugger'
26,8,error,E1101:Class 'traceback' has no 'print_exc' member
26,8,error,E0602:Undefined variable 'traceback'
22,8,warning,W0612:Unused variable 'ptvsd'
54,12,error,E0401:Unable to import 'nose'

------------------------------------------------------------------
Your code has been rated at 1.88/10 (previous run: 1.88/10, +0.00)

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)

No output

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:11
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
karthiknadigcommented, Apr 3, 2019

Yes. The fix is in master.

2reactions
ericsnowcurrentlycommented, Apr 3, 2019

FYI, the fix was merged into PTVSD yesterday morning. @karthiknadig, we’re good to go, right?

Read more comments on GitHub >

github_iconTop Results From Across the Web

In Python unittest, SystemExit: False printed even though ...
When run, this program prints True as expected. Next, I'd like to convert this script into a unittest . I made the following...
Read more >
Unit test with System.exit(); — oracle-tech
So I have a Launcher class that gets called by a shell script and then does some stuff. All errors are caught and...
Read more >
How Python SystemExit Work with Examples
In Python, SystemExit is an exception that is raised by the sys.exit() method. In general, all exceptions must be derived from BaseException which...
Read more >
Testing sys.exit() with pytest - Python Pandemonium
sys.exit will raise exception called SystemExit , which is NOT inherited from Exception class ( Exception and SystemExit both inherited from BaseException )....
Read more >
Debug unit tests with Test Explorer - Visual Studio (Windows)
Because test methods can run in any order, set breakpoints in all the test methods that you want to debug. In Test Explorer,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found