Python Forum
VSCode not able to discover tests
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
VSCode not able to discover tests
#1
My test file is as below:

from unittest import TestCase
import pytest

class TestNumbers(TestCase):
    def TestSum(self):
        self.assertEqual(AddNum(5,6), 11)
        
    def TestDiff(self):
        self.assertEqual(SubtractNum(6,3),3)

obj = TestNumbers()
obj.TestSum()
obj.TestDiff()

# if __name__ == "__main__":
#     unittest.main()
I have set VSCode configuration. Enabled test framework and set it to use pyTest. But each time I start VSCode, it shows message to select Test Framework as no tests were discovered.

In the code given above, the last two lines I have commented. Even when these were enabled, VSCode was not able to discover the tests.
Reply


Messages In This Thread
VSCode not able to discover tests - by rpk2006 - Jul-15-2020, 04:06 AM
RE: VSCode not able to discover tests - by ndc85430 - Jul-15-2020, 04:48 AM
RE: VSCode not able to discover tests - by rpk2006 - Jul-15-2020, 05:01 AM
RE: VSCode not able to discover tests - by ndc85430 - Jul-15-2020, 05:35 AM
RE: VSCode not able to discover tests - by rpk2006 - Jul-15-2020, 05:49 AM
RE: VSCode not able to discover tests - by ndc85430 - Jul-15-2020, 06:03 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Ran 0 tests in 0.000s - unittest Peaches 8 5,196 Dec-31-2021, 08:58 AM
Last Post: Peaches
  StopIteration exception when mock PostgreSQL connection in several tests igor87z 1 2,944 Jun-10-2020, 06:16 PM
Last Post: ibreeden
  Running tests in a sibling directory to code sodhiar 1 2,725 Nov-07-2019, 11:28 PM
Last Post: MckJohan
  pytest loop through multiple tests? burvil 0 4,336 Sep-26-2019, 11:42 PM
Last Post: burvil
  How do i write tests for this code? hshivaraj 0 2,037 Apr-27-2019, 05:28 PM
Last Post: hshivaraj
  Python unittest - running multiple tests from CSV file asheru93 0 4,229 Jan-21-2019, 08:26 AM
Last Post: asheru93
  Tests are not running .Dont why shankar 3 6,343 Sep-20-2018, 07:06 AM
Last Post: shankar

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020