My google search here only shows this most-related answer here; though I can only have my code working for test method BUT NOT with unittest TestCase class method.
My question is how to get fixture value from test method declared within a unittest TestCase class?
I quote the code snippet here
import pytest
from unittest import TestCase
@pytest.fixture()
def fx_return_value():
yield 'some returned value'
@pytest.mark.usefixtures(fx_return_value.__name__)
def test0(fx_return_value):
print(fx_return_value)
class Test1(TestCase):
@pytest.mark.usefixtures(fx_return_value.__name__)
def test1(self, fx_return_value): #TODO Error here > TypeError: test1() missing 1 required positional argument: 'fx_return_value'
print(fx_return_value)