Skip to content

Commit b17badf

Browse files
committed
♻️ Fix empty_config context manager
The `empty_config` context manager is used for some of the testing infrastructure of the installation commands. It relied on some methods for adapting the AiiDA configuration folder, whose API has been changed in aiidateam/aiida-core@9baf3ca Here we adapt the context manager to rely on the new API using the `AiiDAConfigDir`.
1 parent 625c1be commit b17badf

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

tests/cli/test_install.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def empty_config() -> Config:
2929
from aiida.manage.configuration import settings
3030

3131
current_config = configuration.CONFIG
32-
current_config_path = current_config.dirpath
32+
current_config_path = pathlib.Path(current_config.dirpath)
3333
current_profile = configuration.get_profile()
3434
current_path_variable = os.environ.get(settings.DEFAULT_AIIDA_PATH_VARIABLE, None)
3535

@@ -39,8 +39,7 @@ def empty_config() -> Config:
3939
with tempfile.TemporaryDirectory() as dirpath:
4040
dirpath_config = pathlib.Path(dirpath) / 'config'
4141
os.environ[settings.DEFAULT_AIIDA_PATH_VARIABLE] = str(dirpath_config)
42-
settings.AIIDA_CONFIG_FOLDER = str(dirpath_config)
43-
settings.set_configuration_directory()
42+
settings.AiiDAConfigDir.set(dirpath_config)
4443
configuration.CONFIG = configuration.load_config(create=True)
4544

4645
try:
@@ -51,8 +50,7 @@ def empty_config() -> Config:
5150
else:
5251
os.environ[settings.DEFAULT_AIIDA_PATH_VARIABLE] = current_path_variable
5352

54-
settings.AIIDA_CONFIG_FOLDER = current_config_path
55-
settings.set_configuration_directory()
53+
settings.AiiDAConfigDir.set(current_config_path)
5654
configuration.CONFIG = current_config
5755

5856
if current_profile:

0 commit comments

Comments
 (0)