@pytest.fixture(autouse=True, scope='session')
def setup_db_if_needed(request, tests_use_db):
 if (tests_use_db and (not request.config.getvalue('reuse_db'))):
  return request.getfuncargvalue('post_db_setup')

@ pytest . fixture ( autouse = True , scope = 'session' ) def setup_db_if_needed ( request , tests_use_db ) : if ( tests_use_db and ( not request . config . getvalue ( 'reuse_db' ) ) ) : return request . getfuncargvalue ( 'post_db_setup' )
sets up the site db only if tests requested to use the db .