You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Test results not updated if test is run via codelens #6787
After fixing a test case and running it via the codelens "Run Test" the success icon in the codelens and the error squiggle on the function should reflect that result
Actual behaviour
Running a test removes the success/failure icon in front of the codelens. Error squiggles are added if the test fails, but not removed, when it succeeds.
Steps to reproduce:
create test function (e.g. def test_foo(): assert True)
Use "Run All Tests" -> tick mark appears in code lens
change to assert False. Run with codelens "Run Test" -> Tick dissappears, error squiggles appear
change back to assert True and run with codelens -> Output shows success, no tick, error squiggles persist
Run with "Run All Tests" -> tick mark appears in code lens, error squiggles removed
Logs
Logs look good, e.g. Python Test Log has =========================== 1 passed in 0.06 seconds ===========================
I found the issue to be solved when removing the -c /dev/null from pytestArgs. I was using this to force vanilla pytest which is not affected by e.g. my users .pytestrc (or what that file is called)
Somehow this seems to interfere with VSC test result discovery.
I see a similar issue with nose, without any extra arguments and regardless of the way I start the tests (side bar, run all tests, ...). python.testing.pytestArgs is not set.
If this issue is more general, could the issue description be changed, e.g., to "Test results not updated if tests reside in subdirectory"?
Activity
DonJayamanne commentedon Aug 2, 2019
Thanks for reporting this issue, please could you:
settings.json(I'm interested in see the test framework you are using - unittest, nose or pytest)Test Log(please send everything)Flamefire commentedon Aug 2, 2019
I'm using pytest with versions above in pyenv, no other related options used
Test output does not show anything unexpected, just test passed/failed as when running pytest directly
Will add files once I'm back at the machine
Flamefire commentedon Aug 7, 2019
Settings.json: (
grep python)Test.log
Screenshort after clicking "Run Test":
Cause
I found the issue to be solved when removing the
-c /dev/nullfrompytestArgs. I was using this to force vanilla pytest which is not affected by e.g. my users .pytestrc (or what that file is called)Somehow this seems to interfere with VSC test result discovery.
DonJayamanne commentedon Aug 8, 2019
I can replicate this at my end.
For some reason the discovered tests are being reported as existing in the root directory and not under
testsfolder.bersbersbers commentedon Oct 4, 2019
I see a similar issue with
nose, without any extra arguments and regardless of the way I start the tests (side bar, run all tests, ...).python.testing.pytestArgsis not set.If this issue is more general, could the issue description be changed, e.g., to "Test results not updated if tests reside in subdirectory"?
brettcannon commentedon Jul 29, 2021
The traditional codelenses are gone in the future test provider UI, but I can verify that refreshing from the gutter works.