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
For some reason we need to reload window everytime for changes in the setting to take effect.
It seems the setting doesn't work when using forward slashes in windows:
Have the following test ./Test/test2.py where . is workspace folder
import unittest # The test framework
class Test_TestIncrementDecrement1(unittest.TestCase):
def test_increment(self):
f = open("./demofile.txt", "r")
print(f.read())
self.assertEqual(2, 4)
if __name__ == '__main__':
unittest.main()
And ./demofile.txt carrying some random content.
Set python.testing.cwd to ./Test. Run the file, it doesn't work. Setting python.testing.cwd to .\\Test works.
You also able to using TEST EXPLORER of VSCode for testing with setting in my previous comment.
But you will be got a problems with TEST EXPLORER of VSCode: run a test case or test class is working normally but debugging will throws an exception Unhandled exception in thread started by.
I am running the tests directly using play button, not debugging it.
And that's not how you set debugging which is why it's throwing an error, please see #11587. If that doesn't work I recommend to open up a new issue.
You also able to using TEST EXPLORER of VSCode for testing with setting in my previous comment. But you will be got a problems with TEST EXPLORER of VSCode: run a test case or test class is working normally but debugging will throws an exception Unhandled exception in thread started by.
This launchfile doesnt work for me anymore... Do you have the same problem?
everything works in this issue except: "need to reload window everytime for changes in the setting to take effect". Will create another issue about this specifically but all other aspects of this issue are resolved.
Activity
anzvanie commentedon May 15, 2020
The below setting is working for me with python unittest
Remember you need to restart your VSCode application after modify your
settings.jsonfile.karrtikr commentedon May 15, 2020
This issue is about having
.inpython.testing.cwd. Does that work for you?anzvanie commentedon May 16, 2020
I don't think having
.inpython.testing.cwdor not is difference."python.testing.cwd": ".\\path\to\yourworkingdir"still working for me.anzvanie commentedon May 18, 2020
Kartik Raj (@karrtikr) what's way you running for test.
If using
launch.jsonfile and run directly your file, you need to set working directory manually withcwdpropertyYou also able to using
TEST EXPLORERof VSCode for testing with setting in my previous comment.But you will be got a problems with
TEST EXPLORERof VSCode: run a test case or test class is working normally but debugging will throws an exceptionUnhandled exception in thread started by.karrtikr commentedon May 18, 2020
I am running the tests directly using play button, not debugging it.
And that's not how you set debugging which is why it's throwing an error, please see #11587. If that doesn't work I recommend to open up a new issue.
[-]`python.testing.cwd` does not work anymore[/-][+]`python.testing.cwd` does not work properly[/+][-]`python.testing.cwd` does not work properly[/-][+]`python.testing.cwd` does not work properly with `.`[/+][-]`python.testing.cwd` does not work properly with `.`[/-][+]`python.testing.cwd` does not work properly[/+]b-reich commentedon Mar 12, 2022
This launchfile doesnt work for me anymore... Do you have the same problem?
eleanorjboyd commentedon Oct 30, 2023
everything works in this issue except: "need to reload window everytime for changes in the setting to take effect". Will create another issue about this specifically but all other aspects of this issue are resolved.