Skip to content

Commit

Permalink
test_group.py all require reset DB
Browse files Browse the repository at this point in the history
  • Loading branch information
unkcpz committed Nov 29, 2024
1 parent 2b4eda3 commit 39d083f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/tools/archive/orm/test_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from aiida.tools.archive import create_archive, import_archive


def test_nodes_in_group(aiida_profile, tmp_path, aiida_localhost):
def test_nodes_in_group(aiida_profile_clean, tmp_path, aiida_localhost):
"""This test checks that nodes that belong to a specific group are
correctly imported and exported.
"""
Expand Down Expand Up @@ -51,7 +51,7 @@ def test_nodes_in_group(aiida_profile, tmp_path, aiida_localhost):
filename1 = tmp_path / 'export1.aiida'
create_archive([sd1, jc1, gr1], filename=filename1)
n_uuids = [sd1.uuid, jc1.uuid]
aiida_profile.reset_storage()
aiida_profile_clean.reset_storage()
import_archive(filename1)

# Check that the imported nodes are correctly imported and that
Expand All @@ -65,7 +65,7 @@ def test_nodes_in_group(aiida_profile, tmp_path, aiida_localhost):
assert builder.count() == 1, 'The group was not found.'


def test_group_export(tmp_path, aiida_profile):
def test_group_export(tmp_path, aiida_profile_clean):
"""Exporting a group includes its extras and nodes."""
# Create a new user
new_email = uuid.uuid4().hex
Expand All @@ -89,7 +89,7 @@ def test_group_export(tmp_path, aiida_profile):
filename = tmp_path / 'export.aiida'
create_archive([group], filename=filename)
n_uuids = [sd1.uuid]
aiida_profile.reset_storage()
aiida_profile_clean.reset_storage()
import_archive(filename)

# Check that the imported nodes are correctly imported and that
Expand All @@ -105,7 +105,7 @@ def test_group_export(tmp_path, aiida_profile):
assert imported_group.base.extras.get('test') == 1, 'Extra missing on imported group'


def test_group_import_existing(tmp_path, aiida_profile):
def test_group_import_existing(tmp_path, aiida_profile_clean):
"""Testing what happens when I try to import a group that already exists in the
database. This should raise an appropriate exception
"""
Expand All @@ -130,7 +130,7 @@ def test_group_import_existing(tmp_path, aiida_profile):
# At this point we export the generated data
filename = tmp_path / 'export1.aiida'
create_archive([group], filename=filename)
aiida_profile.reset_storage()
aiida_profile_clean.reset_storage()

# Creating a group of the same name
group = orm.Group(label='node_group_existing')
Expand All @@ -154,7 +154,7 @@ def test_group_import_existing(tmp_path, aiida_profile):
assert builder.count() == 2


def test_import_to_group(tmp_path, aiida_profile):
def test_import_to_group(tmp_path, aiida_profile_clean):
"""Test `group` parameter
Make sure an unstored Group is stored by the import function, forwarding the Group object.
Make sure the Group is correctly handled and used for imported nodes.
Expand All @@ -167,7 +167,7 @@ def test_import_to_group(tmp_path, aiida_profile):
# Export Nodes
filename = tmp_path / 'export.aiida'
create_archive([data1, data2], filename=filename)
aiida_profile.reset_storage()
aiida_profile_clean.reset_storage()

# Create Group, do not store
group_label = 'import_madness'
Expand Down

0 comments on commit 39d083f

Please sign in to comment.