Refs: #15750
Complexity: 3
Create Issue
Requirements
- Install python extension from here: https://pvsc.blob.core.windows.net/extension-builds/ms-python-insiders.vsix
- Make sure you have
"python.experiments.optInto": ["All"], in your user settings. If you did not have it, add it and reload.
Testing
- Open an empty folder in VS Code.
- Add following
unittest code (name your file my_tests.py). Do not name it unittest.py that will override the unittest library:
import unittest
class PassingTests(unittest.TestCase):
def test_passing(self):
self.assertEqual(42, 42)
def test_passing_still(self):
self.assertEqual("silly walk", "silly walk")
class FailingTests(unittest.TestCase):
def test_failure(self):
self.assertEqual(42, -13)
def test_failure_still(self):
self.assertEqual("I'm right!", "no, I am!")
- Select any python version.
- You can either configure tests using
Python: configure tests... command from the command pallet, or go the test view and configure by using the welcome view, or you can run tests to get a prompt to configure.
- Select
unittest framework.
- You should see the tests in the test view. Run the tests.
- Add your own test methods, or add another test file, the test UI should update accordingly.
Refs: #15750
Complexity: 3
Create Issue
Requirements
"python.experiments.optInto": ["All"],in your user settings. If you did not have it, add it and reload.Testing
unittestcode (name your filemy_tests.py). Do not name itunittest.pythat will override theunittestlibrary:Python: configure tests...command from the command pallet, or go the test view and configure by using the welcome view, or you can run tests to get a prompt to configure.unittestframework.