-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
166 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
########################################################################### | ||
# Copyright (c), The AiiDA team. All rights reserved. # | ||
# This file is part of the AiiDA code. # | ||
# # | ||
# The code is hosted on GitHub at https://github.com/aiidateam/aiida-core # | ||
# For further information on the license, see the LICENSE.txt file # | ||
# For further information please visit http://www.aiida.net # | ||
########################################################################### | ||
"""Tests for the dumping of ProcessNode data to disk.""" | ||
|
||
from __future__ import annotations | ||
|
||
import io | ||
import shutil | ||
from pathlib import Path | ||
|
||
from _pytest.tmpdir import tmp_path | ||
import pytest | ||
|
||
from aiida.tools.dumping.incremental import IncrementalDumper | ||
from aiida import orm | ||
from aiida.manage import get_manager | ||
|
||
# @pytest.fixture(scope='class', autouse=True) | ||
# def setup_test_dumper(test_dumper): | ||
|
||
|
||
@pytest.mark.usefixtures("init_profile") | ||
class TestIncrementalDumper: | ||
|
||
@classmethod | ||
def setup_class(cls): | ||
|
||
cls.int: orm.Node = orm.Int(1).store() | ||
cls.float: orm.Node = orm.Float(1.0).store() | ||
cls.str: orm.Node = orm.Str('a').store() | ||
|
||
cls.groups = { | ||
'add': orm.Group(label='add').store(), | ||
'add_multiply': orm.Group(label='add_multiply').store(), | ||
} | ||
|
||
kpoints = orm.KpointsData() | ||
kpoints.set_kpoints_mesh(mesh=[1]*3) | ||
cls.kpoints = kpoints | ||
cls.structuredata = orm.StructureData(cell=((1.0, 0.0, 0.0), (0.0, 1.0, 0.0), (0.0, 0.0, 1.0))).store() | ||
|
||
|
||
# other organizational entities | ||
cls.manager = get_manager() | ||
cls.profile = cls.manager.get_profile() | ||
cls.storage = cls.manager.get_profile_storage() | ||
|
||
# for dev | ||
cls.storage_info: dict = cls.storage.get_info(detailed=True) | ||
|
||
# Add one ArithmeticAddNode not in any group | ||
# cls.add_node = generate_calculation_node_add() | ||
# cls.multiply_add_node = generate_workchain_multiply_add() | ||
|
||
@pytest.fixture(scope="session", autouse=True) | ||
def init_profile( | ||
self, | ||
tmpdir_factory | ||
): | ||
"""Initialize the profile.""" | ||
# Cannot put this into `setup_class`, as then `tmpdir_factory` is expected as an actual argument | ||
self.incremental_dumper: IncrementalDumper = IncrementalDumper(dump_parent_path=tmpdir_factory.mktemp('incr') / 'dump-parent') | ||
|
||
def test_update_uuids_before_dump(self): | ||
# print(wc_node) | ||
from aiida.cmdline.utils import echo | ||
print(self.float) | ||
pass | ||
# print(self.storage_info) | ||
# self.incremental_dumper.update_uuids_before_dump() | ||
# # echo.echo_dictionary(self.storage_info) | ||
# assert False | ||
# pass | ||
|
||
def test_update_uuids_after_dump(self, tmp_path): | ||
pass | ||
|
||
|
||
# cj_nodes = [ | ||
# generate_calculation_node_io(attach_outputs=False), | ||
# generate_calculation_node_io(attach_outputs=False), | ||
# ] | ||
# wc_node = generate_workchain_node_io(cj_nodes=cj_nodes) | ||
|
||
|
||
|
||
# @pytest.fixture(scope="session", autouse=True) | ||
# def init_profile( | ||
# self, | ||
# # aiida_localhost, | ||
# # tmp_path, # -> Function-scoped | ||
# tmpdir_factory | ||
# ): | ||
# """Initialize the profile.""" | ||
# # Add one of each orm entity of interest to the profile | ||
# # self.computer: orm.Computer = aiida_localhost | ||
# # self.authinfo: orm.AuthInfo = self.computer.get_authinfo(user=orm.User.collection.get_default()) | ||
# # self.code: orm.Code = orm.InstalledCode(computer=self.computer, filepath_executable='/bin/true').store() | ||
# self.int: orm.Node = orm.Int(1).store() | ||
# # self.float: orm.Node = orm.Float(1.0).store() | ||
# # self.str: orm.Node = orm.Str('a').store() | ||
|
||
# # self.groups = { | ||
# # 'add': orm.Group(label='add').store(), | ||
# # 'add_multiply': orm.Group(label='add_multiply').store(), | ||
# # } | ||
|
||
# # kpoints = orm.KpointsData() | ||
# # kpoints.set_kpoints_mesh(mesh=[1]*3) | ||
# # self.kpoints = kpoints | ||
# # self.structuredata = orm.StructureData(cell=((1.0, 0.0, 0.0), (0.0, 1.0, 0.0), (0.0, 0.0, 1.0))).store() | ||
|
||
# # self.incremental_dumper: IncrementalDumper = IncrementalDumper(dump_parent_path=tmpdir_factory.mktemp('incr') / 'dump-parent') | ||
|
||
# # # other organizational entities | ||
# # self.manager = get_manager() | ||
# # self.profile = self.manager.get_profile() | ||
# # self.storage = self.manager.get_profile_storage() | ||
|
||
# # # for dev | ||
# # self.storage_info: dict = self.storage.get_info(detailed=True) | ||
|
||
# # Add one ArithmeticAddNode not in any group | ||
# # self.add_node = generate_calculation_node_add() | ||
# # self.multiply_add_node = generate_workchain_multiply_add() |