forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
area-testingbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bug
Description
VS Code version
1.64.0-insider
Extension version
v2021.12.1559732655
OS type
macOS
OS version
11.6
Python distribution
python.org
Python version
3.7
Language server
Pylance
Expected behaviour
VSCode should show a "run" button next to my test methods, with decorator or not
Actual behaviour
VSCode shows the "run" button next to the decorator definition instead of the test method
Steps to reproduce
Enable unittest in VSCode
Paste this code
import unittest
def decorated(f):
def wrapper(*args):
print("decorated")
return f(*args)
return wrapper
class TestStuff(unittest.TestCase):
@decorated
def test_stuff(self):
assert 1 == 1You will see the "run" button appear next to def wrapper(*args):, but it should be on def test_stuff(self):
Edit:
Bonus: every decorated method will go to its decorated function, so you can have 100 tests all on that one line
Logs
> ~/.local/share/virtualenvs/[REDUCTED_PATH]-SM8362Ue/bin/python ~/.vscode-insiders/extensions/ms-python.python-2021.12.1559732655/pythonFiles/testing_tools/unittest_discovery.py [REDUCTED_PATH] test*.py
cwd: [REDUCTED_PATH]
Edit:
Output of that discovery:
start
test_lol:TestStuff:test_stuff:4
Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
area-testingbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bug