I have a class that I want to use in various test cases/files to test certain conditions.
Something like the following:
class MyTester:
@staticmethod
def does_string_apply(my_string: str) -> bool:
return my_string == 'Hello World'
I want to use that class in various test cases among various test files, which is why I defined it in conftest and provided a fixture to access that class.
@pytest.fixture(name=my_tester)
def fixture_my_tester() -> type[MyTester]:
return MyTester
That fixture is used in the test cases, but the class name is not imported. Therefore, I do not know how to type hint the fixture:
def test_something(my_tester: type['What goes here?']) -> None:
assert my_tester.does_string_apply("Hello")