`python.testing.cwd` does not work properly
See original GitHub issue-
Update setting description saying it only works with absolute paths. Folks often try relative paths which do not work for them https://github.com/microsoft/vscode-python/issues/15739#issuecomment-847618474.
-
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.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
python.testing.cwd ignored when discovering or running tests
Seems like we don't take python.testing.cwd into account anymore when discovering tests, or running single tests using pytest.
Read more >vscode-python runs pytest in wrong directory such that relative ...
In the 'Settings' pane, search for 'python.testing.cwd'. The docs say that 'cwd' 'Specifies an optional working directory for unit tests.'.
Read more >Testing Python in Visual Studio Code
Unit tests are concerned only with the unit's interface—its arguments and return values—not with its implementation (which is why no code is shown...
Read more >Python Unit Testing With VS Code
VS Code can automatically recognize existing Python tests and run them. Learn how to configure it to run test suites, individual tests as...
Read more >Set up unit testing for Python code - Visual Studio
The Run menu gives you commands to run failed, passed, or not run tests as a group. You can select one or more...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The below setting is working for me with python unittest
Remember you need to restart your VSCode application after modify your
settings.json
file.This launchfile doesnt work for me anymore… Do you have the same problem?