-
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
Debugging tests using pytest shows"TypeError: message must be set" message #14067
Comments
I had the same error:
I did nothing else except try to run a particular unit test within a test file via the test debugger. Details:
|
Thank you for reaching out @ChadBailey and @lazarillo! Can you reproduce this issue with multiple versions of pytest, or is it happening only when using 6.0.2? As a side note, if other users come forward and leave a comment demonstrating they are seeing/reproducing the problem, we will raise this issue's priority. Thanks! |
I am having the exact same problem using: [04:47 PM] >pytest --version [04:47 PM] >python --version It runs my tests and then errors after pytest completes.... ========================= 4 passed, 3 xfailed in 0.32s ========================= tests/test_base_executor.py ....xxx [100%] -------------- generated xml file: /tmp/tmp-2792E648AgEDEUge.xml --------------- |
Interestingly, I could reproduce the issue if I pick @seanwsmithm3 and @lazarillo do you have a sample repo I could use to try and replicate your issue when running the test? For everyone: What is the output of running in the terminal the equivalent to the command ran by the extension: path/to/python -m pytest --override-ini junit_family=xunit1 --rootdir path/to/workspace/folder --junit-xml=/path/to/a/random/xmlfile.xml . |
Take a look at microsoft/vscode-cmake-tools#1432, and the associated PR. |
That's excellent timing @int19h, because I was doing some digging and I was reaching the same conclusion: diagnostics must have a message. In our current code the message (on line 500) can sometimes be vscode-python/src/client/testing/common/managers/baseTestManager.ts Lines 498 to 505 in 61b179b
Alright everyone, no need for info anymore, the problematic area has been narrowed down 🔍 @ChadBailey (sorry for the many pings), if you have a reliable repro case for the Thank you everyone! |
@kimadeline no worries on the pings, glad I've been able to contribute in some way... That said, exact same IDE and exact same code on exact same machine as bug report was filed on and I can no longer reproduce. I also am no longer experiencing the [desirable] behavior of breaking on unhandled exceptions [see #14056]. |
I've been unable to reproduce the My config: {
"python.pythonPath": "/usr/local/bin/python3",
"python.testing.pytestArgs": ["."],
"python.testing.unittestEnabled": false,
"python.testing.nosetestsEnabled": false,
"python.testing.pytestEnabled": true
}
def test_this():
assert True
def test_that():
assert False
|
@ChadBailey Just wanted to add that I am seeing this bug as well, and it's affecting the outcome of my tests. Although the unit tests pass if it's in debug mode or if they are just running normally, I decided to write the output of my tests to a JSON file. The two are producing different files despite both passing the tests. I don't know if this has any implications as to what the issue could be. Forgive the poor quality of the gif, but this should show what I'm talking about better than I can explain it: |
Hi @chs-sapentintia, if you havne't done so yet please upvote (👍) the initial post to help us prioritize it. Thanks! |
In case it helps anyone else, I was experiencing this issue (inside an attached Docker container) and resolved it by setting |
I found the same problem. I just created a test that compares the resulting output from a file. |
I'm seeing this in Debug Console for every test:
Despite having set |
for me the issue was having set in python.testing.pytestargs
after i removed all the params debuging was working |
I am observing the same issue too. |
I am observing the same issue too. And my local dev environment is not work. |
I had the same issue and fixed it by adding |
Thanks, briangrahamww! Adding "--no-cov" removed the warning "TypeError: message must be set". |
This should be fixed in the insiders version of the Python extension (View > Command Palette... and run "Python: Switch to Insiders Weekly Channel" command). Please do try it out, we will release this fix soon! |
This should have been out on the December release. If you still see this problem with the newest version let us know. |
Environment data
python.languageServer
setting: 0.5.51.0Full language server log
Expected behaviour
No error
Actual behaviour
Receiving error
Error: TypeError: message must be set
inPython Test Log
when debugging tests (pytest) with accompanying error toast (see image)Also occasionally receiving error:
Steps to reproduce:
[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]
main.py
main_test.py
Logs
The text was updated successfully, but these errors were encountered: