Skip to content

Got SystemExit when run an unittest without debug. #1529

@weqopy

Description

@weqopy

Environment data

  • VS Code version: 1.22.2
  • Extension version (available under the Extensions sidebar): 2018.3.1 (29 Mar 2018)
  • OS and version: macOS High Sierra 10.13.4
  • Python version (& distribution if applicable, e.g. Anaconda): python 3.6.5
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): virtualenv
  • Relevant/affected Python packages and their versions: XXX

Actual behavior

Here is the unittest:

import unittest


class Solution:
    def powerSum(self, x, y):
        return x**2 + y**2


class testTmp(unittest.TestCase):
    def test_powerSum(self):
        tmp = Solution().powerSum(3, 4)
        self.assertEqual(tmp, 25)


if __name__ == '__main__':
    unittest.main()
  1. run this in debug mode, it's okey
.
----------------------------------------------------------------------
Ran 1 test in 0.001s
OK
  1. but when run it without debug
----------------------------------------------------------------------
Ran 1 test in 0.000s
OK
Traceback (most recent call last):  File "/Users/***/Documents/pyfiles/tmp.py", line 19, in <module>
    unittest.main()
  File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/unittest/main.py", line 95, in __init__
    self.runTests()
  File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/unittest/main.py", line 258, in runTests
    sys.exit(not self.result.wasSuccessful())
SystemExit: False

Metadata

Metadata

Assignees

Labels

area-testingbugIssue identified by VS Code Team member as probable bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions