def aiida_profile(): """Set up AiiDA test profile for the duration of the tests. Note: scope='session' limits this fixture to run once per session. Thanks to ``autouse=True``, you don't actually need to depend on it explicitly - it will activate as soon as you import it in your ``conftest.py``. """ with test_manager(backend=get_test_backend_name(), profile_name=get_test_profile_name()) as manager: yield manager
from aiida.manage.tests import test_manager from aiida.cmdline.commands import cmd_computer, cmd_code from aiida.tools.importexport import export_zip from click.testing import CliRunner from glob import glob import os print("Setting up test profile") export_file = "export.aiida" try: os.remove(export_file) except OSError: pass with test_manager() as test_mgr: cli_runner = CliRunner() for computer in ['fidis', 'deneb']: computer_yml = '{c}/{c}.yml'.format(c=computer) print("Setting up {}".format(computer)) options = ['--config', computer_yml] result = cli_runner.invoke(cmd_computer.computer_setup, options) print(result) for code_yml in glob('{c}/*@*.yml'.format(c=computer)): print("Setting up {}".format(code_yml)) options = ['--config', code_yml] result = cli_runner.invoke(cmd_code.setup_code, options) print(result)