Closed
Description
Since 8.2.0 and changes to unittest collecting pytests behaves now slightly differently. If there is @Property defined in unittest class it is called during tests collection. This leads to some absurd behaviour with each property being collected twice. Attached example takes 20s to collect instead of 0.01s
import unittest
from time import sleep
class TestClass(unittest.TestCase):
@property
def variable(self):
print('My collection sleep')
sleep(10)
class MyTest(TestClass):
def test_simple(self):
assert True
pip list output:
pip list
Package Version
------------------------- ---------
attrs 23.2.0
cffi 1.16.0
cryptography 42.0.8
exceptiongroup 1.2.1
iniconfig 2.0.0
jsonschema 4.22.0
jsonschema-specifications 2023.12.1
packaging 24.1
pip 22.0.4
pluggy 1.5.0
pycparser 2.22
pyOpenSSL 24.1.0
pytest 8.2.2
referencing 0.35.1
rpds-py 0.18.1
setuptools 58.1.0
tomli 2.0.1