-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unittest: Only the last TestCase in alphabetical order was executed #14733
Comments
Thanks for the bug report! We investigate issues in order based on priority and severity, which includes the impact it has on your ability to use the extension to do productive work, and the number of people affected. If other users come forward and leave a comment demonstrating they are seeing/reproducing the problem then we will raise this issue's priority. If you think your issue is more of a question or configuration problem rather than a bug, please ask on Stack Overflow with the Thanks for your understanding and patience! |
I have encountered the same error. After a bit of digging around, it seems that the cause is in for test_suite in suites._tests:
for cls in test_suite._tests:
try:
for m in cls._tests:
testId = m.id()
if testId.startswith(opts.tests[0]):
suite = cls
if testId == opts.tests[0]:
tests = unittest.TestSuite([m])
break
except Exception as err:
errorMessage = traceback.format_exception()
pass
if tests is None:
tests = suite Each
this seems to resolve the issue. Presumably, the check The only issue I see still remaining is that if
FWIW, I'm attaching a diff of all my edits (although it might take longer to download and merge, than to re-type it.. :) ). Thanks! |
It looks like this is the same problem as in #10972 which says we should get a fix soon. |
For anyone running into this. Please try the insiders edition of the extension to see if this is addressed. |
I tried the two-class sample code from the original post in Insiders and it looks fixed, thanks. |
Yes, it looks like it's fixed. Thanks! |
I have the same problem even use with insiders VS Code version: 1.60.0-insider Actual behaviour: Same, will run the last TestCase error msg:
|
@k870611 I meant insider version of Python extension (it should be 2021.9.*) you can download it here https://pvsc.blob.core.windows.net/extension-builds/ms-python-insiders.vsix |
thanks, it work now. |
I have found a bug of this version. I will create log to recode test message and it will be created for each test ( if I write 10 test in py it will create 10 log file) but in official release 2021.8.1147840270 it will create once ( even I create 10 test in py it will only create once and recode all test message into log) FYR |
Environment data
python.languageServer
setting: Jedi (default)Expected behaviour
The expected behaviour is if I click on the "Run Current Test File" all test classes and functions are executed.
Actual behaviour
The actual behaviour is only the last TestCase in alphabetically order and its functions are executed (Run all and one-by-one classes are ok).
Steps to reproduce:
(Here is a complete workspace)
Logs
Output for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)Log of test discovery and running one file (without venv):
Log of test discovery and running one file (with venv):
The text was updated successfully, but these errors were encountered: