aiida_crystal17.tests package¶
Subpackages¶
- aiida_crystal17.tests.raw_files package
- aiida_crystal17.tests.test_calculations package
- aiida_crystal17.tests.test_cmndline package
- aiida_crystal17.tests.test_data package
- aiida_crystal17.tests.test_immigration package
- aiida_crystal17.tests.test_parsers package
- Subpackages
- aiida_crystal17.tests.test_parsers.test_raw package
- Submodules
- aiida_crystal17.tests.test_parsers.test_raw.test_crystal_fermi module
- aiida_crystal17.tests.test_parsers.test_raw.test_crystal_fort25 module
- aiida_crystal17.tests.test_parsers.test_raw.test_crystal_stdout module
- aiida_crystal17.tests.test_parsers.test_raw.test_gui_parse module
- aiida_crystal17.tests.test_parsers.test_raw.test_inputd12_read module
- aiida_crystal17.tests.test_parsers.test_raw.test_inputd12_write module
- Module contents
- aiida_crystal17.tests.test_parsers.test_raw package
- Submodules
- aiida_crystal17.tests.test_parsers.test_cry_doss module
- aiida_crystal17.tests.test_parsers.test_cry_main module
- aiida_crystal17.tests.test_parsers.test_cry_newk module
- Module contents
- Subpackages
- aiida_crystal17.tests.test_symmetry package
- aiida_crystal17.tests.test_validation package
- aiida_crystal17.tests.test_workflows package
Submodules¶
aiida_crystal17.tests.cx1_submission_tests module¶
submit a test parallel run to Imperial HPC CX1
can use: verdi run aiida_crystal17/tests/cx1_submission_tests.py
for info on parallel calculations see: http://tutorials.crystalsolutions.eu/tutorial.html?td=tuto_HPC&tf=tuto_hpc
aiida_crystal17.tests.mock_crystal17 module¶
this is a mock version of runcry17, which compares an input file to a hash, and writes an appropriate outputfile to stdoout
to create a hashkey:
import hashlib
input_path = 'path/to/input.d12'
with open(input_path, "rb") as f:
hashkey = hashlib.md5(f.read()).hexdigest()
hashkey
aiida_crystal17.tests.mock_gulp module¶
this is a mock version of gulp (v4.5.3), which compares an input file to a hash, and writes an appropriate outputfile to stdoout
to create a hashkey:
import hashlib
input_path = 'path/to/input.d12'
with open(input_path, "rb") as f:
hashkey = hashlib.md5(f.read()).hexdigest()
hashkey
aiida_crystal17.tests.mock_properties17 module¶
this is a mock version of runcry17, which compares an input file to a hash, and writes an appropriate outputfile to stdoout
to create a hashkey:
import hashlib
input_path = 'path/to/input.d12'
with open(input_path, "rb") as f:
hashkey = hashlib.md5(f.read()).hexdigest()
hashkey
aiida_crystal17.tests.utils module¶
-
class
aiida_crystal17.tests.utils.
AiidaTestApp
(work_directory, executable_map, environment=None)[source]¶ Bases:
object
a class providing methods for testing purposes
- Parameters
work_directory (str) – path to a local work directory (used when creating computers)
executable_map (dict) – mapping of computation entry points to the executable name
environment (None or aiida.manage.fixtures.FixtureManager) – manager of a temporary AiiDA environment
-
static
check_calculation
(calc_node, expected_outgoing_labels, error_include=(('results', 'errors'), ('results', 'parser_errors')))[source]¶ check a calculation has completed successfully
-
property
environment
¶ return manager of a temporary AiiDA environment
-
static
generate_calcinfo
(entry_point_name, folder, inputs=None)[source]¶ generate a CalcInfo instance for testing calculation jobs.
A new CalcJob process instance is instantiated, and prepare_for_submission is called to populate the supplied folder, with raw inputs.
- Parameters
entry_point_name (str) –
folder (aiida.common.folders.Folder) –
-
generate_calcjob_node
(entry_point_name, retrieved=None, computer_name='localhost', options=None, mark_completed=False, remote_path=None, input_nodes=None)[source]¶ Fixture to generate a mock CalcJobNode for testing parsers.
- Parameters
entry_point_name (str) – entry point name of the calculation class
retrieved (aiida.orm.FolderData) – containing the file(s) to be parsed
computer_name (str) – used to get or create a
Computer
, by default ‘localhost’options (None or dict) – any additional metadata options to set on the node
remote_path (str) – path to a folder on the computer
mark_completed (bool) – if True, set the process state to finished, and the exit_status = 0
input_nodes (dict) – mapping of link label to node
- Returns
instance with the retrieved node linked as outgoing
- Return type
-
static
generate_context
(wkchain_cls, inputs, outline_steps)[source]¶ instantiate a WorkChain, call a list of methods (that should be part of spec.outline), then return a sanitized version of the workchain context for testing
-
static
get_calc_cls
(entry_point_name)[source]¶ load a data node class
- Parameters
entry_point_name (str) – entry point name of the data node class
-
static
get_data_node
(entry_point_name, **kwargs)[source]¶ load a data node instance
- Parameters
entry_point_name (str) – entry point name of the data node class
- Returns
- Return type
-
static
get_default_metadata
(max_num_machines=1, max_wallclock_seconds=1800, with_mpi=False, dry_run=False)[source]¶
-
get_or_create_code
(entry_point, computer_name='localhost')[source]¶ Setup code on localhost computer
-
static
parse_from_node
(entry_point_name, node, retrieved_temporary_folder=None)[source]¶ load a parser class
- Parameters
entry_point_name (str) – entry point name of the parser class
- Returns
- Return type
-
property
work_directory
¶ return path to the work directory
-
aiida_crystal17.tests.utils.
get_default_metadata
(max_num_machines=1, max_wallclock_seconds=1800, with_mpi=False, num_mpiprocs_per_machine=1, dry_run=False)[source]¶ Return an instance of the metadata dictionary with the minimally required parameters for a CalcJob and set to default values unless overridden
- Parameters
max_num_machines – set the number of nodes, default=1
max_wallclock_seconds – set the maximum number of wallclock seconds, default=1800
with_mpi – whether to run the calculation with MPI enabled
num_mpiprocs_per_machine – set the number of cpus per node, default=1
- Return type
-
aiida_crystal17.tests.utils.
get_or_create_code
(entry_point, computer, executable, exec_path=None)[source]¶ Setup code on localhost computer
-
aiida_crystal17.tests.utils.
get_or_create_local_computer
(work_directory, name='localhost')[source]¶ Retrieve or setup a local computer
- Parameters
- Returns
- Return type
-
aiida_crystal17.tests.utils.
get_path_to_executable
(executable)[source]¶ Get path to local executable.
-
aiida_crystal17.tests.utils.
parse_from_node
(cls, node, store_provenance=True, retrieved_temporary_folder=None)[source]¶ Parse the outputs directly from the CalcJobNode.
If store_provenance is set to False, a CalcFunctionNode will still be generated, but it will not be stored. It’s storing method will also be disabled, making it impossible to store, because storing it afterwards would not have the expected effect, as the outputs it produced will not be stored with it.
This method is useful to test parsing in unit tests where a CalcJobNode can be mocked without actually having to run a CalcJob. It can also be useful to actually re-perform the parsing of a completed CalcJob with a different parser.
- Parameters
node – a CalcJobNode instance
store_provenance – bool, if True will store the parsing as a CalcFunctionNode in the provenance
- Returns
a tuple of the parsed results and the CalcFunctionNode representing the process of parsing
Module contents¶
tests for the plugin that does not pollute your profiles/databases.