Skip to content
This repository has been archived by the owner on Sep 18, 2018. It is now read-only.

AttributeError: 'function' object has no attribute 'cursor' #208

Closed
tommagic opened this issue Oct 27, 2016 · 2 comments
Closed

AttributeError: 'function' object has no attribute 'cursor' #208

tommagic opened this issue Oct 27, 2016 · 2 comments

Comments

@tommagic
Copy link

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
Copy link
Member

fizyk commented Oct 27, 2016

@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
Copy link
Member

fizyk commented Nov 14, 2016

This issue was moved to ClearcodeHQ/pytest-postgresql#24

@fizyk fizyk closed this as completed Nov 14, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants