Skip to content

Instantly share code, notes, and snippets.

@afbio
Created March 29, 2018 12:54
Show Gist options
  • Save afbio/70a9dc306bdfd76daf6fe93d89fca67d to your computer and use it in GitHub Desktop.
Save afbio/70a9dc306bdfd76daf6fe93d89fca67d to your computer and use it in GitHub Desktop.
Reset database sequence among tests on same module
# Postgre tested
@pytest.fixture(autouse=True)
def reset_sequence():
cur = connection.cursor()
cur.execute('ALTER SEQUENCE table_name RESTART WITH 1;')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment