-
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
Unittest discovery silently fails when Pytest is not installed #21688
Comments
realized this is likely the fix: #21726 |
I ran into this as well, so if you were expecting it to be fixed, I don't think it is. I was also curious why pytest is used to do discovery for |
pytest should not be needed if you are just using |
@roblourens, testing this and unable to reproduce the behavior. Could you send over the test file you had loaded and the settings you picked (when configuring testing so it might look something like below)
|
Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on, then we will be happy to re-open this issue to pick up where we left off. Happy Coding! |
Repro steps
"python.experiments.optInto": [
"pythonTestAdapter"
],
"python.terminal.executeInFileDir": true,
"python.createEnvironment.trigger": "prompt",
def xyz():
return 0
import unittest
class TestScratch(unittest.TestCase):
def test_add(self):
pass
{
"python.testing.unittestArgs": [
"-v",
"-s",
".",
"-p",
"test_*.py"
],
"python.testing.pytestEnabled": false,
"python.testing.unittestEnabled": true
}
|
hm tried these steps and still not seeing it, will keep my eye out as I have seen this before but also couldn't repro it a second time. |
From: #22833 filed by @luabud with repo steps Type: Bug BehaviourWhen trying to set up test discovery with unittest, I can only get pytest to trigger discovery to trigger. Even though I have the following settings in my workspace:
Steps to reproduce:
import unittest
class TestStringMethods(unittest.TestCase):
def test_upper(self):
self.assertEqual("hello".upper(), "HELLO")
def test_isupper(self):
self.assertTrue("HELLO".isupper())
self.assertFalse("Hello".isupper())
def test_split(self):
s = "hello world"
self.assertEqual(s.split(), ["hello", "world"])
# check that s.split fails when the separator is not a string
with self.assertRaises(TypeError):
s.split(2)
Diagnostic data
Output for
|
Item | Value |
---|---|
CPUs | 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz (8 x 2995) |
GPU Status | 2d_canvas: enabled canvas_oop_rasterization: enabled_on direct_rendering_display_compositor: disabled_off_ok gpu_compositing: enabled multiple_raster_threads: enabled_on opengl: enabled_on rasterization: enabled raw_draw: disabled_off_ok skia_graphite: disabled_off video_decode: enabled video_encode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: enabled |
Load (avg) | undefined |
Memory (System) | 31.71GB (12.58GB free) |
Process Argv | --log trace --log ms-python.autopep8=debug --crash-reporter-id 11494669-52ca-4f2c-aa0e-29172189cc8e |
Screen Reader | no |
VM | 0% |
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vsc_aa:30263845
vscod805:30301674
vsaa593:30376534
py29gd2263:30784851
c4g48928:30535728
2i9eh265:30646982
962ge761:30841072
pythongtdpath:30726887
welcomedialog:30812478
pythonidxpt:30768918
pythonnoceb:30776497
asynctok:30898717
dsvsc013:30777762
dsvsc014:30777825
dsvsc015:30821418
pythontestfixt:30866404
pythonregdiag2:30926734
pyreplss1:30879911
pythonmypyd1:30859725
pythoncet0:30859736
pythontbext0:30879054
accentitlementst:30870582
dsvsc016:30879898
dsvsc017:30880771
dsvsc018:30880772
8082a590:30953407
edj9j583:30943796
fegfb526:30952798
7j2b6412:30951517
bg6jg535:30946824
@luabud tried the steps and got success with no reference to the pytest error. Are you able to repro this if you try multiple times or is it flaky for you too? |
seems to be flaky too, I am unable to repro this today |
@eleanorjboyd ah just reproduced it again! funny enough by downgrading to the previous release version I can't repro (could be a coincidence I guess!) same settings:
one thing I noticed though is that whenever I can't reproduce it, it's because the tests had been discovered before successfully. So for example, I clone a repo for the first time, I configure the test features to use unittest all using v2024.0.0, I can repro the issue. But then when I downgrade to v2023.22,1, tests are discovered. Then I upgrade to 2024.0.0, retrigger test discovery, it continues to work. Could be a big coincidence, but this it was consistently the case for me. |
found the issue and am working on a solution: |
error is now surfaced explaining you need to reload as there is a misalignment- this is sufficient given the frequency it shows up |
Testing #13301
The text was updated successfully, but these errors were encountered: