|
| 1 | +########################################################################### |
| 2 | +# Copyright (c), The AiiDA team. All rights reserved. # |
| 3 | +# This file is part of the AiiDA code. # |
| 4 | +# # |
| 5 | +# The code is hosted on GitHub at https://github.com/aiidateam/aiida-core # |
| 6 | +# For further information on the license, see the LICENSE.txt file # |
| 7 | +# For further information please visit http://www.aiida.net # |
| 8 | +########################################################################### |
| 9 | +"""Tests for the dumping of group data to disk.""" |
| 10 | + |
| 11 | +# TODO: Test that de-duplication also works for calculations |
| 12 | + |
| 13 | +import pytest |
| 14 | +from pathlib import Path |
| 15 | +from aiida import orm |
| 16 | + |
| 17 | + |
| 18 | +@pytest.mark.usefixtures('aiida_profile_clean') |
| 19 | +@pytest.fixture(scope='session', autouse=True) |
| 20 | +def setup_profile_groups(generate_calculation_node_add, generate_workchain_multiply_add): |
| 21 | + # Create nodes for profile storage |
| 22 | + int_node = orm.Int(1).store() |
| 23 | + _ = generate_calculation_node_add() |
| 24 | + _ = generate_workchain_multiply_add() |
| 25 | + cj_node = generate_calculation_node_add() |
| 26 | + wc_node = generate_workchain_multiply_add() |
| 27 | + |
| 28 | + # Create the various groups |
| 29 | + add_group = orm.Group.collection.get_or_create(label='add')[0] |
| 30 | + multiply_add_group = orm.Group.collection.get_or_create(label='multiply-add')[0] |
| 31 | + cj_dupl_group = orm.Group.collection.get_or_create(label='cj-dupl')[0] |
| 32 | + wc_dupl_group = orm.Group.collection.get_or_create(label='wc-dupl')[0] |
| 33 | + no_process_group = orm.Group.collection.get_or_create(label='add')[0] |
| 34 | + |
| 35 | + # Populate groups |
| 36 | + add_group.add_nodes([cj_node]) |
| 37 | + multiply_add_group.add_nodes([wc_node]) |
| 38 | + cj_dupl_group.add_nodes([cj_node]) |
| 39 | + wc_dupl_group.add_nodes([wc_node]) |
| 40 | + no_process_group.add_nodes([int_node]) |
| 41 | + |
| 42 | + # Not sure if this is actually needed? |
| 43 | + return { |
| 44 | + 'add_group': add_group, |
| 45 | + 'multiply_add_group': multiply_add_group, |
| 46 | + 'cj_dupl_group': cj_dupl_group, |
| 47 | + 'wc_dupl_group': wc_dupl_group, |
| 48 | + 'no_process_group': no_process_group, |
| 49 | + } |
| 50 | + |
| 51 | + |
| 52 | +class TestGroupDumper: |
| 53 | + |
| 54 | + def test_should_dump_processes(self): |
| 55 | + print(orm.QueryBuilder().append(orm.Group).all(flat=True)) |
| 56 | + assert False |
| 57 | + # pass |
| 58 | + |
| 59 | + def test_get_nodes(self): |
| 60 | + pass |
| 61 | + |
| 62 | + def test_get_processes(self): |
| 63 | + pass |
| 64 | + |
| 65 | + def test_dump_processes(self): |
| 66 | + pass |
| 67 | + |
| 68 | + def test_dump_calculations(self): |
| 69 | + pass |
| 70 | + |
| 71 | + def test_dump_workflows(self): |
| 72 | + pass |
| 73 | + |
| 74 | + def test_dump(self): |
| 75 | + pass |
0 commit comments