Q: How to add arguments to the function passed in request.addfinalizer() of pytest? I am writing a test suite with pytest. It looks like this.
@pytest.fixture
def f(request):
    ...
    def fin(arg):
        ...
        return

    request.addfinalizer(fin)

I am wondering if 'arg' would be taken into account inside off 'addfinalizer'?
Or is it a way to do that?

A: You can pass a lambda like this:
@pytest.fixture
def f(request):
    ...
    def fin(arg):
        ...
        return

    request.addfinalizer(lambda: fin(some_arg_here))


A: use a functools.partial or a lambda 
