Skip to content

Instantly share code, notes, and snippets.

@nguyendv
Created March 14, 2018 15:19
Show Gist options
  • Save nguyendv/84acda790ea48924b068c2b7c347ca2d to your computer and use it in GitHub Desktop.
Save nguyendv/84acda790ea48924b068c2b7c347ca2d to your computer and use it in GitHub Desktop.
@pytest.fixture
def db_conn():
conn = psycopg2.connect("dbname=test user=postgres")
return conn
def test_foo(db_conn):
result = db_conn.execute(a_sql_statement)
assert result == expected_value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment