Skip to content

Commit edfd903

Browse files
author
Vasileios Karakasis
authored
Merge pull request #1630 from teojgo/feat/disable_old_settings
[feat] Drop support for old configuration syntax
2 parents dbb5e91 + 3185118 commit edfd903

File tree

3 files changed

+13
-23
lines changed

3 files changed

+13
-23
lines changed

docs/migration_2_to_3.rst

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,18 @@ Updating Your Site Configuration
1414
--------------------------------
1515

1616
As described in `Configuring ReFrame for Your Site <configure.html>`__, ReFrame's configuration file has changed substantially.
17-
However, you don't need to manually update your configuration; ReFrame will do that automatically for you.
18-
As soon as it detects an old-style configuration file, it will convert it to the new syntax save it in a temporary file:
19-
20-
21-
.. code-block:: none
22-
23-
$ ./bin/reframe -C unittests/resources/settings_old_syntax.py -l
24-
./bin/reframe: the syntax of the configuration file 'unittests/resources/settings_old_syntax.py' is deprecated
25-
./bin/reframe: configuration file has been converted to the new syntax here: '/var/folders/h7/k7cgrdl13r996m4dmsvjq7v80000gp/T/tmph5n8u3kf.py'
26-
27-
Alternatively, you can convert any old configuration file using the command line option :option:`--upgrade-config-file`:
17+
However, you can convert any old configuration file using the command line option :option:`--upgrade-config-file`:
2818

2919
.. code-block:: none
3020
3121
$ ./bin/reframe --upgrade-config-file unittests/resources/settings_old_syntax.py:new_config.py
3222
Conversion successful! The converted file can be found at 'new_config.py'.
3323
24+
.. warning::
25+
.. versionchanged:: 3.4
26+
The old configuration syntax in no longer supported and it will not be automatically converted by the `-C` option.
27+
28+
3429
Another important change is that default locations for looking up a configuration file has changed (see `Configuring ReFrame for Your Site <configure.html>`__ for more details).
3530
That practically means that if you were relying on ReFrame loading your ``reframe/settings.py`` by default, this is no longer true.
3631
You have to move it to any of the default settings locations or set the corresponding command line option or environment variable.
@@ -39,8 +34,8 @@ You have to move it to any of the default settings locations or set the correspo
3934
The conversion tool will create a JSON configuration file if the extension of the target file is ``.json``.
4035

4136

42-
Automatic conversion limitations
43-
================================
37+
Configuration conversion limitations
38+
====================================
4439

4540
ReFrame does a pretty good job in converting correctly your old configuration files, but there are some limitations:
4641

reframe/core/config.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,11 @@
1515
import tempfile
1616

1717
import reframe
18-
import reframe.core.fields as fields
1918
import reframe.core.settings as settings
2019
import reframe.utility as util
21-
import reframe.utility.osext as osext
22-
import reframe.utility.typecheck as types
2320
from reframe.core.environments import normalize_module_list
2421
from reframe.core.exceptions import ConfigError, ReframeFatalError
2522
from reframe.core.logging import getlogger
26-
from reframe.core.warnings import ReframeDeprecationWarning
2723
from reframe.utility import ScopedDict
2824

2925

@@ -229,9 +225,10 @@ def _create_from_python(cls, filename):
229225

230226
if hasattr(mod, 'settings'):
231227
# Looks like an old style config
232-
raise ReframeDeprecationWarning(
233-
f"the syntax of the configuration file '{filename}' "
234-
f"is deprecated"
228+
raise ConfigError(
229+
f"the syntax of the configuration file {filename!r} "
230+
f"is no longer supported; please convert it using the "
231+
f"'--upgrade-config-file' option"
235232
)
236233

237234
mod = util.import_module_from_file(filename)

unittests/test_config.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@
44
# SPDX-License-Identifier: BSD-3-Clause
55

66
import json
7-
import os
87
import pytest
98

109
import reframe.core.config as config
1110
from reframe.core.exceptions import ConfigError
1211
from reframe.core.systems import System
13-
from reframe.core.warnings import ReframeDeprecationWarning
1412

1513

1614
def test_load_config_fallback(monkeypatch):
@@ -24,7 +22,7 @@ def test_load_config_python():
2422

2523

2624
def test_load_config_python_old_syntax():
27-
with pytest.raises(ReframeDeprecationWarning):
25+
with pytest.raises(ConfigError):
2826
site_config = config.load_config(
2927
'unittests/resources/settings_old_syntax.py'
3028
)

0 commit comments

Comments
 (0)