microsoft / vscode-python

Python extension for Visual Studio Code
https://aka.ms/pvsc-marketplace
MIT License
4.29k stars 1.17k forks source link

No Tests discovered pop-up shows up even after discovering and running tests #1491

Closed karthiknadig closed 6 years ago

karthiknadig commented 6 years ago

Actual behavior

image

Expected behavior

Pop-up should not show up.

Steps to reproduce:

  1. Create scratch3.py:
    a = {0: 1, 1: 1}
    def F(n):
    if n < 0:
        raise ValueError('Value is invalid: ' + str(n))
    if n in a:
        return a[n]
    x = F(n - 1) + F(n - 2)
    a[n] = x
    return x
  2. Create Test scratch3_tests.py:
    
    import unittest
    from scratch3 import F

class MyTest(unittest.TestCase): def test_0(self): self.assertEqual(1, F(0))

def test_1(self):
    self.assertEqual(1, F(1))

def test_2(self):
    self.assertEqual(2, F(2))

def test_100(self):
    self.assertEqual(573147844013817084101L, F(100))

def test_neg1(self):
    self.assertRaises(ValueError, F, -1)

if name == 'main': unittest.main()

3. Settings:
"python.unitTest.unittestArgs": [
    "-v",
    "-s",
    ".",
    "-p",
    "*_tests.py"
],
"python.unitTest.unittestEnabled": true,
## Logs

start scratch3_tests.MyTest.test_0 scratch3_tests.MyTest.test_1 scratch3_tests.MyTest.test_100 scratch3_tests.MyTest.test_2 scratch3_tests.MyTest.test_neg1 test_0 (scratch3_tests.MyTest) ... ok test_1 (scratch3_tests.MyTest) ... ok test_100 (scratch3_tests.MyTest) ... ok test_2 (scratch3_tests.MyTest) ... ok test_neg1 (scratch3_tests.MyTest) ... ok


Ran 5 tests in 0.001s

OK

brettcannon commented 6 years ago

How did this trigger? Did you try to run the tests without the testing being configured yet? Did you set the configuration and then write the test file?

karthiknadig commented 6 years ago

I wrote the test file first. then tried to run it. It would bring up this UI: image After finishing the configuration the test tests not detected UI would show up. One thing that i changed is the pattern for test file name from *_test.py to *_tests.py.

brettcannon commented 6 years ago

OK, now I get what's going on. You're getting the notification initially because we can't find any tests until you updated your settings.json, but we didn't cancel the notification after your update and us noticing that we could now find tests.

brettcannon commented 6 years ago

@karthiknadig so @qubitron and I are disagreeing on what you mean. 😄 Did you mean that the notification popped up a second time after making the configuration change, or did you leave the notification up while editing your settings and you wanted it automatically dismissed for you?

karthiknadig commented 6 years ago

The pop-up reappeared after dismissing.

DonJayamanne commented 6 years ago

@karthiknadig Are you still able to replicate this issue?

karthiknadig commented 6 years ago

I don't see the pop up constantly showing up. But test detection is incorrect. It ran 6 test cases, detected only 3: image image

brettcannon commented 6 years ago

OK, so the old issue seems solved, so I'm closing this one. @karthiknadig can you open a new one for the checkbox issue?