Been using pytest for a few days and enjoying it greatly. However, the last bit of code I wrote just blew up with "INTERNALERROR> TypeError: unhashable type: 'dict'".

It seems that if you parameterize a fixture function, it must be with a list of immutable values. This works:

@pytest.fixture(params=[1, 2, 3])
def foo(request):
    return request.param
def bar(foo):
    assert foo

This doesn't:

@pytest.fixture(params=[{a:1}, {a:2}, {a:3}])
def foo(request):
    return request.param
def bar(foo):
    assert foo

...because dict is immutable.

I didn't see this requirement mentioned in the docs, and I don't understand why it would be the case. Looking for enlightenment.

-ofer
_______________________________________________
Pytest-dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pytest-dev

Reply via email to