AttributeError: 'function' object has no attribute 'cursor'
Closed this issue · 2 comments
tommagic commented
I follow the example here - http://pytest-dbfixtures.readthedocs.io/en/latest/howtouse.html for postgres -
from pytest_dbfixtures import factories
postgresql_proc2 = factories.postgresql_proc(port=9876)
postgresql2 = factories.postgresql('postgresql_proc2')
cur = postgresql2.cursor()
I get the following error -
AttributeError: 'function' object has no attribute 'cursor'
My version is - pytest-dbfixtures==0.16.0 and psycopg2==2.6.2, postgres 9.6 running locally.
What do I do wrong?
fizyk commented
@tommagic you'd have to change it a bit:
cur = postgresql2().cursor()
And event then, it's a pytest fixture, that depends on other pytest fixture.
def test_two_postgreses(postgresql, postgresql2):
cur = postgresql.cursor()
fizyk commented
This issue was moved to ClearcodeHQ/pytest-postgresql#24