Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion aiida/manage/tests/pytest_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,31 @@ def aiida_profile():


@pytest.fixture(scope='function')
def clear_database(aiida_profile): # pylint: disable=redefined-outer-name
def clear_database(clear_database_after_test): # pylint: disable=redefined-outer-name,unused-argument
"""Alias for 'clear_database_after_test'.

Clears the database after each test. Use of the explicit
'clear_database_after_test' is preferred.
"""


@pytest.fixture(scope='function')
def clear_database_after_test(aiida_profile): # pylint: disable=redefined-outer-name
"""Clear the database after each test.
"""
yield
# after the test function has completed, reset the database
aiida_profile.reset_db()


@pytest.fixture(scope='function')
def clear_database_before_test(aiida_profile): # pylint: disable=redefined-outer-name
"""Clear the database before each test.
"""
aiida_profile.reset_db()
yield


@pytest.fixture(scope='function')
def temp_dir():
"""Get a temporary directory.
Expand Down