aiida.backends package¶
Subpackages¶
- aiida.backends.djsite package
- aiida.backends.general package
- aiida.backends.sqlalchemy package
- aiida.backends.tests package
Submodules¶
-
aiida.backends.profile.
is_profile_loaded
()[source]¶ Return True if the profile has already been loaded
-
aiida.backends.profile.
load_profile
(process=None, profile=None)[source]¶ Load the profile. This function is called by load_dbenv and SHOULD NOT be called by the user by hand.
-
class
aiida.backends.testbase.
AiidaTestCase
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
This is the base class for AiiDA tests, independent of the backend.
Internally it loads the AiidaTestImplementation subclass according to the current backend
-
_AiidaTestCase__backend_instance
= None¶
-
__module__
= 'aiida.backends.testbase'¶
-
_class_was_setup
= False¶
-
computer
¶ A class that, when used as a decorator, works as if the two decorators @property and @classmethod where applied together (i.e., the object works as a property, both for the Class and for any of its instance; and is called with the class cls rather than with the instance as its first argument).
-
classmethod
setUpClass
(*args, **kwargs)[source]¶ Hook method for setting up class fixture before running tests in the class.
-
classmethod
tearDownClass
(*args, **kwargs)[source]¶ Hook method for deconstructing the class fixture after running all tests in the class.
-
user_email
¶ A class that, when used as a decorator, works as if the two decorators @property and @classmethod where applied together (i.e., the object works as a property, both for the Class and for any of its instance; and is called with the class cls rather than with the instance as its first argument).
-
-
aiida.backends.testbase.
check_if_tests_can_run
()[source]¶ Check if the tests can run (i.e., if we are in a test profile). Otherwise, raise TestsNotAllowedError.
-
aiida.backends.testbase.
run_aiida_db_tests
(tests_to_run, verbose=False)[source]¶ Run all tests specified in tests_to_run. Return the list of test results.
-
class
aiida.backends.testimplbase.
AiidaTestImplementation
[source]¶ Bases:
object
For each implementation, define what to do at setUp and tearDown.
Each subclass must reimplement two standard methods (i.e., not classmethods), called respectively
setUpClass_method
andtearDownClass_method
. It is also required to implement setUp_method and tearDown_method to be run for each single test They can set local properties (e.g.self.xxx = yyy
) but remember thatxxx
is not visible to the upper (calling) Test class.Moreover, it is required that they define in the setUpClass_method the two properties:
self.computer
that must be a Computer objectself.user_email
that must be a string
These two are then exposed by the
self.get_computer()
andself.get_user_email()
methods.-
__abstractmethods__
= frozenset(['insert_data', 'setUpClass_method', 'tearDownClass_method', 'setUp_method', 'tearDown_method', 'clean_db'])¶
-
__dict__
= dict_proxy({'get_computer': <function get_computer>, 'insert_data': <function insert_data>, '__module__': 'aiida.backends.testimplbase', '__metaclass__': <class 'abc.ABCMeta'>, '_abc_negative_cache': <_weakrefset.WeakSet object>, 'clean_db': <function clean_db>, '_abc_registry': <_weakrefset.WeakSet object>, '__abstractmethods__': frozenset(['insert_data', 'setUpClass_method', 'tearDownClass_method', 'setUp_method', 'tearDown_method', 'clean_db']), 'get_user_email': <function get_user_email>, 'setUpClass_method': <function setUpClass_method>, '_abc_cache': <_weakrefset.WeakSet object>, 'tearDownClass_method': <function tearDownClass_method>, 'setUp_method': <function setUp_method>, 'tearDown_method': <function tearDown_method>, '__dict__': <attribute '__dict__' of 'AiidaTestImplementation' objects>, '_abc_negative_cache_version': 39, '__weakref__': <attribute '__weakref__' of 'AiidaTestImplementation' objects>, '__doc__': '\n For each implementation, define what to do at setUp and tearDown.\n\n Each subclass must reimplement two *standard* methods (i.e., *not* classmethods), called\n respectively ``setUpClass_method`` and ``tearDownClass_method``.\n It is also required to implement setUp_method and tearDown_method to be run for each single test\n They can set local properties (e.g. ``self.xxx = yyy``) but remember that ``xxx``\n is not visible to the upper (calling) Test class.\n\n Moreover, it is required that they define in the setUpClass_method the two properties:\n\n - ``self.computer`` that must be a Computer object\n - ``self.user_email`` that must be a string\n\n These two are then exposed by the ``self.get_computer()`` and ``self.get_user_email()``\n methods.\n '})¶
-
__metaclass__
¶ alias of
abc.ABCMeta
-
__module__
= 'aiida.backends.testimplbase'¶
-
__weakref__
¶ list of weak references to the object (if defined)
-
_abc_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version
= 39¶
-
_abc_registry
= <_weakrefset.WeakSet object>¶
-
setUpClass_method
()[source]¶ This class prepares the database (cleans it up and installs some basic entries). You have also to set a self.computer and a self.user_email as explained in the docstring of the AiidaTestImplemention docstring.
-
aiida.backends.utils.
_get_column
(colname, alias)[source]¶ Return the column for a given projection. Needed by the QueryBuilder
-
aiida.backends.utils.
get_backend_type
()[source]¶ Set the schema version stored in the DB. Use only if you know what you are doing.
-
aiida.backends.utils.
get_current_profile
()[source]¶ Return, as a string, the current profile being used.
Return None if load_dbenv has not been loaded yet.
-
aiida.backends.utils.
is_dbenv_loaded
()[source]¶ Return True of the dbenv was already loaded (with a call to load_dbenv), False otherwise.
-
aiida.backends.utils.
set_backend_type
(backend_name)[source]¶ Set the schema version stored in the DB. Use only if you know what you are doing.
-
aiida.backends.utils.
validate_attribute_key
(key)[source]¶ Validate the key string to check if it is valid (e.g., if it does not contain the separator symbol.).
Returns: None if the key is valid Raises: ValidationError – if the key is not valid