Closed
Description
Environment data
- VS Code version: 1.60
- Extension version: v2021.9.1191016588
- OS and version: Windows 20H2
- Python version: 3.9.2
- Type of virtual environment used: none
- Relevant/affected Python packages and their versions: Unittest
- Value of the
python.languageServer
setting: Pylance
Expected behaviour
When running discovered tests with Unittest as a class, the execution of a whole test class should call method setUpClass
once.
The behaviour should follow the design of setUp
and setUpClass
with the former being run once for each test, the latter once for each class.
Actual behaviour
When running all tests, tests are run one by one. This leads to an execution of setUpClass
for each test, negating possible efficiency gains.
The behaviour changed from expected to actual between beginning of August and September 3rd.
Steps to reproduce:
- Add test file to test explorer
- Run all tests
Minimal Working Example
import unittest
import time
class set_up_Test(unittest.TestCase):
@classmethod
def setUpClass(cls):
#long task
time.sleep(5)
def test_1(self):
self.assertEqual(1,1)
def test_2(self):
self.assertEqual(2,2)
def test_3(self):
self.assertEqual(3,3)
def test_4(self):
self.assertEqual(4,4)