use @classmethod per pytest guidance
Fixed class-scoped pytest fixtures that were defined as instance methods
using ``self``, which is deprecated as of pytest 9.1 and will be removed in
pytest 10. Fixtures are now decorated with a compatibility ``@classmethod``
decorator and use ``cls`` as the first parameter.
In the 2.0 branch, the approach is considerably more complicated
as python 3.7, 3.8, 3.9 doesn't work with this pattern; since the
warning appears in pytest 9.1 and not 9.0, which itself is only
python 3.10+, we use a conditional classmethod wrapper.
in the 2.1 branch, we can just use straight `@classmethod`.
Fixes: #13392
Change-Id: I866de54e22569c9d55eb97dce165670994ec4a57
(cherry picked from commit
cd7eeb34d3741c94b2f9476aec7f3386132a71d5)