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
You can either configure tests using Python: configure tests... command from the command pallet, or go the test view and configure by using the welcome view, or you can run tests to get a prompt to configure.
Select unittest framework.
You should see the tests in the test view. Run the tests.
Add your own test methods, or add another test file, the test UI should update accordingly.
Alex Ross (@alexr00) It looks like the test file detection is really fragile. For example if you specify searching for the pattern "*test.py", it will detect a file called "utest.py" but not with more than one character (for example "untest.py").
I was able to get detection to work most reliably with just "test.py".
I'll enter an issue.
I see that the file name is unittest.py, in python the file names are module names. So, if you create a file by the name unittest.py then import unittest in it then it overrides the underlying unittest library. Please name it something else.
Alex Ross (@alexr00) When the config settings are generated see if they look like this. If not, try and add this to settings.json for the project and see if that helps:
Activity
alexr00 commentedon Aug 24, 2021
I followed both of the Requirements steps, but I wasn't able to get this working. Am I missing something?
gregvanl commentedon Aug 24, 2021
Alex Ross (@alexr00) It looks like the test file detection is really fragile. For example if you specify searching for the pattern "*test.py", it will detect a file called "utest.py" but not with more than one character (for example "untest.py").
I was able to get detection to work most reliably with just "test.py".
I'll enter an issue.
alexr00 commentedon Aug 24, 2021
Tried your suggestion Greg Van Liew (@gregvanl) of naming the file utest.py, but it still doesn't work.
karthiknadig commentedon Aug 24, 2021
I see that the file name is
unittest.py, in python the file names are module names. So, if you create a file by the nameunittest.pythen importunittestin it then it overrides the underlyingunittestlibrary. Please name it something else.karthiknadig commentedon Aug 24, 2021
Alex Ross (@alexr00) When the config settings are generated see if they look like this. If not, try and add this to
settings.jsonfor the project and see if that helps:DonJayamanne commentedon Aug 24, 2021
Verified
alexr00 commentedon Aug 25, 2021
I had tested with utest.py yesterday without success. Today I deleted everything in my folder, reloaded, and started over. Success.