diff --git a/docs/deferrable_functions_reference.rst b/docs/deferrable_functions_reference.rst index 1dab287888..19bbea88a0 100644 --- a/docs/deferrable_functions_reference.rst +++ b/docs/deferrable_functions_reference.rst @@ -92,13 +92,5 @@ List of deferrable functions and utilities do_sth() -.. py:decorator:: reframe.utility.sanity.sanity_function(func) - - Please use the :func:`reframe.core.pipeline.RegressionMixin.deferrable` decorator when possible. Alternatively, please use the :func:`reframe.utility.sanity.deferrable` decorator instead. - - .. warning:: Not to be mistaken with :func:`~reframe.core.pipeline.RegressionMixin.sanity_function` built-in. - .. deprecated:: 3.8.0 - - .. automodule:: reframe.utility.sanity :members: diff --git a/docs/regression_test_api.rst b/docs/regression_test_api.rst index b3faf06d36..bd893f1388 100644 --- a/docs/regression_test_api.rst +++ b/docs/regression_test_api.rst @@ -21,10 +21,6 @@ Test Base Classes Test Decorators --------------- -.. autodecorator:: reframe.core.decorators.parameterized_test(*inst) - -.. autodecorator:: reframe.core.decorators.required_version(*versions) - .. autodecorator:: reframe.core.decorators.simple_test @@ -151,6 +147,9 @@ In the following example, :func:`BaseTest.x` will execute before :func:`DerivedT Declaring pipeline hooks using the same name functions from the :py:mod:`reframe` or :py:mod:`reframe.core.decorators` modules is now deprecated. You should use the builtin functions described in the :ref:`builtins` section.. + .. versionchanged:: 4.0.0 + Pipeline hooks can only be defined through the built-in functions described in this section. + .. warning:: .. versionchanged:: 3.9.2 @@ -317,49 +316,6 @@ The :py:mod:`reframe` module offers direct access to the basic test classes, con See :class:`reframe.core.pipeline.RunOnlyRegressionTest`. -.. py:attribute:: reframe.DEPEND_BY_ENV - - See :attr:`reframe.core.pipeline.DEPEND_BY_ENV`. - - -.. py:attribute:: reframe.DEPEND_EXACT - - See :attr:`reframe.core.pipeline.DEPEND_EXACT`. - - -.. py:attribute:: reframe.DEPEND_FULLY - - See :attr:`reframe.core.pipeline.DEPEND_FULLY`. - - -.. py:decorator:: reframe.parameterized_test - - See :func:`@reframe.core.decorators.parameterized_test `. - - -.. py:decorator:: reframe.require_deps - - .. deprecated:: 3.7.0 - Please use the :func:`@require_deps ` builtin decorator. - - -.. py:decorator:: reframe.required_version - - See :func:`@reframe.core.decorators.required_version `. - - -.. py:decorator:: reframe.run_after - - .. deprecated:: 3.7.0 - Please use the :func:`~reframe.core.builtins.run_after` built-in function - - -.. py:decorator:: reframe.run_before - - .. deprecated:: 3.7.0 - Please use the :func:`~reframe.core.builtins.run_before` built-in function - - .. py:decorator:: reframe.simple_test See :func:`@reframe.core.decorators.simple_test `. diff --git a/reframe/__init__.py b/reframe/__init__.py index cd4ea8f81a..a8ffdf2c8c 100644 --- a/reframe/__init__.py +++ b/reframe/__init__.py @@ -6,7 +6,7 @@ import os import sys -VERSION = '3.13.0-dev.0' +VERSION = '4.0.0-dev.0' INSTALL_PREFIX = os.path.normpath( os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) ) diff --git a/reframe/core/containers.py b/reframe/core/containers.py index b35f54b739..d108746b32 100644 --- a/reframe/core/containers.py +++ b/reframe/core/containers.py @@ -6,7 +6,6 @@ import abc import reframe.core.fields as fields -import reframe.core.warnings as warn import reframe.utility as util import reframe.utility.typecheck as typ @@ -39,21 +38,6 @@ class ContainerPlatform(abc.ABC): #: :default: :class:`None` command = fields.TypedField(str, type(None)) - _commands = fields.TypedField(typ.List[str]) - #: The commands to be executed within the container. - #: - #: .. deprecated:: 3.5.0 - #: Please use the `command` field instead. - #: - #: :type: :class:`list[str]` - #: :default: ``[]`` - commands = fields.DeprecatedField( - _commands, - 'The `commands` field is deprecated, please use the `command` field ' - 'to set the command to be executed by the container.', - fields.DeprecatedField.OP_SET, from_version='3.5.0' - ) - #: Pull the container image before running. #: #: This does not have any effect for the `Singularity` container platform. @@ -97,11 +81,6 @@ class ContainerPlatform(abc.ABC): def __init__(self): self.image = None self.command = None - - # NOTE: Here we set the target fields directly to avoid the deprecation - # warnings - self._commands = [] - self.workdir = _STAGEDIR_MOUNT self.mount_points = [] self.options = [] @@ -156,11 +135,6 @@ def create_from(cls, name, other): new.options = other.options new.pull_image = other.pull_image new.workdir = other.workdir - - # Update deprecated fields - with warn.suppress_deprecations(): - new.commands = other.commands - return new @property @@ -193,10 +167,6 @@ def launch_command(self, stagedir): return (f'docker run --rm {" ".join(run_opts)} ' f'{self.image} {self.command}') - if self.commands: - return (f"docker run --rm {' '.join(run_opts)} {self.image} " - f"bash -c '{'; '.join(self.commands)}'") - return f'docker run --rm {" ".join(run_opts)} {self.image}' @@ -241,10 +211,6 @@ def launch_command(self, stagedir): return (f'{self._command} run {" ".join(run_opts)} {self.image} ' f'{self.command}') - if self.commands: - return (f"{self._command} run {' '.join(run_opts)} {self.image} " - f"bash -c '{'; '.join(self.commands)}'") - return f'{self._command} run {" ".join(run_opts)} {self.image}' @@ -296,10 +262,6 @@ def launch_command(self, stagedir): return (f'singularity exec {" ".join(run_opts)} ' f'{self.image} {self.command}') - if self.commands: - return (f"singularity exec {' '.join(run_opts)} {self.image} " - f"bash -c '{'; '.join(self.commands)}'") - return f'singularity run {" ".join(run_opts)} {self.image}' diff --git a/reframe/core/decorators.py b/reframe/core/decorators.py index 2efd793fcb..a04c11335e 100644 --- a/reframe/core/decorators.py +++ b/reframe/core/decorators.py @@ -7,10 +7,7 @@ # Decorators used for the definition of tests # -__all__ = [ - 'parameterized_test', 'simple_test', 'required_version', - 'require_deps', 'run_before', 'run_after' -] +__all__ = ['simple_test'] import collections @@ -19,8 +16,6 @@ import traceback import reframe.utility.osext as osext -import reframe.core.warnings as warn -import reframe.core.hooks as hooks from reframe.core.exceptions import ReframeSyntaxError, SkipTestError, what from reframe.core.fixtures import FixtureRegistry from reframe.core.logging import getlogger, time_function @@ -229,196 +224,3 @@ def simple_test(cls): _register_test(cls, variant_num=n) return cls - - -def parameterized_test(*inst): - '''Class decorator for registering multiple instantiations of a test class. - - The decorated class must derive from - :class:`reframe.core.pipeline.RegressionTest`. This decorator is also - available directly under the :mod:`reframe` module. - - :arg inst: The different instantiations of the test. Each instantiation - argument may be either a sequence or a mapping. - - .. versionadded:: 2.13 - - .. note:: - This decorator does not instantiate any test. It only registers them. - The actual instantiation happens during the loading phase of the test. - - .. deprecated:: 3.6.0 - - Please use the :func:`~reframe.core.pipeline.RegressionTest.parameter` - built-in instead. - - ''' - - warn.user_deprecation_warning( - 'the @parameterized_test decorator is deprecated; ' - 'please use the parameter() built-in instead', - from_version='3.6.0' - ) - - def _do_register(cls): - if _validate_test(cls): - if not cls.param_space.is_empty(): - raise ReframeSyntaxError( - f'{cls.__qualname__!r} is already a parameterized test' - ) - - for args in inst: - _register_parameterized_test(cls, args) - - return cls - - return _do_register - - -def required_version(*versions): - '''Class decorator for specifying the required ReFrame versions for the - following test. - - If the test is not compatible with the current ReFrame version it will be - skipped. - - :arg versions: A list of ReFrame version specifications that this test is - allowed to run. A version specification string can have one of the - following formats: - - 1. ``VERSION``: Specifies a single version. - 2. ``{OP}VERSION``, where ``{OP}`` can be any of ``>``, ``>=``, ``<``, - ``<=``, ``==`` and ``!=``. For example, the version specification - string ``'>=3.5.0'`` will allow the following test to be loaded only - by ReFrame 3.5.0 and higher. The ``==VERSION`` specification is the - equivalent of ``VERSION``. - 3. ``V1..V2``: Specifies a range of versions. - - You can specify multiple versions with this decorator, such as - ``@required_version('3.5.1', '>=3.5.6')``, in which case the test will be - selected if *any* of the versions is satisfied, even if the versions - specifications are conflicting. - - .. versionadded:: 2.13 - - .. versionchanged:: 3.5.0 - - Passing ReFrame version numbers that do not comply with the `semantic - versioning `__ specification is deprecated. - Examples of non-compliant version numbers are ``3.5`` and ``3.5-dev0``. - These should be written as ``3.5.0`` and ``3.5.0-dev.0``. - - .. deprecated:: 3.5.0 - Please set the ``require_version`` parameter in the class definition - instead. - - ''' - warn.user_deprecation_warning( - "the '@required_version' decorator is deprecated; please set " - "the 'require_version' parameter in the class definition instead", - from_version='3.7.0' - ) - - if not versions: - raise ReframeSyntaxError('no versions specified') - - conditions = [VersionValidator(v) for v in versions] - - def _skip_tests(cls): - mod = inspect.getmodule(cls) - if not hasattr(mod, '__rfm_skip_tests'): - mod.__rfm_skip_tests = set() - - if not hasattr(mod, '_rfm_test_registry'): - mod._rfm_test_registry = TestRegistry() - - if not any(c.validate(osext.reframe_version()) for c in conditions): - getlogger().warning( - f"skipping incompatible test '{cls.__qualname__}': not valid " - f"for ReFrame version {osext.reframe_version().split('-')[0]}" - ) - if cls in mod._rfm_test_registry: - mod._rfm_test_registry.skip(cls) - else: - mod.__rfm_skip_tests.add(cls) - - return cls - - return _skip_tests - - -# Valid pipeline stages that users can specify in the `run_before()` and -# `run_after()` decorators -_USER_PIPELINE_STAGES = ( - 'init', 'setup', 'compile', 'run', 'sanity', 'performance', 'cleanup' -) - - -def run_before(stage): - '''Decorator for attaching a test method to a pipeline stage. - - .. deprecated:: 3.7.0 - Please use the :func:`~reframe.core.pipeline.RegressionMixin.run_before` - built-in function. - - ''' - warn.user_deprecation_warning( - 'using the @rfm.run_before decorator from the rfm module is ' - 'deprecated; please use the built-in decorator @run_before instead.', - from_version='3.7.0' - ) - if stage not in _USER_PIPELINE_STAGES: - raise ReframeSyntaxError( - f'invalid pipeline stage specified: {stage!r}') - - if stage == 'init': - raise ReframeSyntaxError('pre-init hooks are not allowed') - - return hooks.attach_to('pre_' + stage) - - -def run_after(stage): - '''Decorator for attaching a test method to a pipeline stage. - - .. deprecated:: 3.7.0 - Please use the :func:`~reframe.core.pipeline.RegressionMixin.run_after` - built-in function. - - ''' - warn.user_deprecation_warning( - 'using the @rfm.run_after decorator from the rfm module is ' - 'deprecated; please use the built-in decorator @run_after instead.', - from_version='3.7.0' - ) - if stage not in _USER_PIPELINE_STAGES: - raise ReframeSyntaxError( - f'invalid pipeline stage specified: {stage!r}') - - # Map user stage names to the actual pipeline functions if needed - if stage == 'init': - stage = '__init__' - elif stage == 'compile': - stage = 'compile_wait' - elif stage == 'run': - stage = 'run_wait' - - return hooks.attach_to('post_' + stage) - - -def require_deps(fn): - '''Decorator to denote that a function will use the test dependencies. - - .. versionadded:: 2.21 - - .. deprecated:: 3.7.0 - Please use the - :func:`~reframe.core.pipeline.RegressionTest.require_deps` built-in - function. - - ''' - warn.user_deprecation_warning( - 'using the @rfm.require_deps decorator from the rfm module is ' - 'deprecated; please use the built-in decorator @require_deps instead.', - from_version='3.7.0' - ) - return hooks.require_deps(fn) diff --git a/reframe/core/launchers/__init__.py b/reframe/core/launchers/__init__.py index 7a61d71512..d187c9a74f 100644 --- a/reframe/core/launchers/__init__.py +++ b/reframe/core/launchers/__init__.py @@ -66,7 +66,7 @@ class LauncherWrapper(JobLauncher): .. code:: python - @rfm.run_after('setup') + @run_after('setup') def set_launcher(self): self.job.launcher = LauncherWrapper(self.job.launcher, 'ddt', ['--offline']) diff --git a/reframe/core/pipeline.py b/reframe/core/pipeline.py index 8612e0e0a8..2d5910dee4 100644 --- a/reframe/core/pipeline.py +++ b/reframe/core/pipeline.py @@ -9,12 +9,10 @@ __all__ = [ 'CompileOnlyRegressionTest', 'RegressionTest', 'RunOnlyRegressionTest', - 'DEPEND_BY_ENV', 'DEPEND_EXACT', 'DEPEND_FULLY', 'final', 'RegressionMixin' ] -import functools import glob import inspect import itertools @@ -44,8 +42,6 @@ ReframeSyntaxError) from reframe.core.meta import RegressionTestMeta from reframe.core.schedulers import Job -from reframe.core.variables import DEPRECATE_WR -from reframe.core.warnings import user_deprecation_warning class _NoRuntime(ContainerPlatform): @@ -62,40 +58,6 @@ def launch_command(self, stagedir): raise NotImplementedError -# Dependency kinds - -#: Constant to be passed as the ``how`` argument of the -#: :func:`~RegressionTest.depends_on` method. It denotes that test case -#: dependencies will be explicitly specified by the user. -#: -#: This constant is directly available under the :mod:`reframe` module. -#: -#: .. deprecated:: 3.3 -#: Please use a callable as the ``how`` argument. -DEPEND_EXACT = 1 - -#: Constant to be passed as the ``how`` argument of the -#: :func:`RegressionTest.depends_on` method. It denotes that the test cases of -#: the current test will depend only on the corresponding test cases of the -#: target test that use the same programming environment. -#: -#: This constant is directly available under the :mod:`reframe` module. -#: -#: .. deprecated:: 3.3 -#: Please use a callable as the ``how`` argument. -DEPEND_BY_ENV = 2 - -#: Constant to be passed as the ``how`` argument of the -#: :func:`RegressionTest.depends_on` method. It denotes that each test case of -#: this test depends on all the test cases of the target test. -#: -#: This constant is directly available under the :mod:`reframe` module. -#: -#: .. deprecated:: 3.3 -#: Please use a callable as the ``how`` argument. -DEPEND_FULLY = 3 - - # Valid systems/environments mini-language _N = r'(\w[-.\w]*)' # name _NW = rf'(\*|{_N})' # name or wildcard @@ -125,21 +87,6 @@ def launch_command(self, stagedir): ) -def final(fn): - fn._rfm_final = True - user_deprecation_warning( - 'using the @rfm.final decorator from the rfm module is ' - 'deprecated; please use the built-in decorator @final instead.', - from_version='3.7.0' - ) - - @functools.wraps(fn) - def _wrapped(*args, **kwargs): - return fn(*args, **kwargs) - - return _wrapped - - _RFM_TEST_KIND_MIXIN = 0 _RFM_TEST_KIND_COMPILE = 1 _RFM_TEST_KIND_RUN = 2 @@ -236,28 +183,7 @@ def pipeline_hooks(cls): return ret - #: The name of the test. - #: - #: This is an alias of :attr:`unique_name`. - #: - #: .. warning:: - #: - #: Setting the name of a test is deprecated and will be disabled in the - #: future. If you were setting the name of a test to circumvent the old - #: long parameterized test names in order to reference them in - #: dependency chains, please refer to :ref:`param_deps` for more details - #: on how to achieve this. - #: - #: .. versionchanged:: 3.10.0 - #: Setting the :attr:`name` attribute is deprecated. - #: - name = deprecate(variable(typ.Str[r'[^\/]+'], - attr_name='_rfm_unique_name', loggable=True), - "setting the 'name' attribute is deprecated and " - "will be disabled in the future", DEPRECATE_WR) - - #: List of environments or environment features or environment properties - #: required by this test. + #: List of programming environments supported by this test. #: #: The syntax of this attribute is exactly the same as of the #: :attr:`valid_systems` except that the ``a:b`` entries are invalid. @@ -1166,6 +1092,14 @@ def unique_name(self): ''' return self._rfm_unique_name + @property + def name(self): + '''The name of the test. + + This is an alias of :attr:`unique_name`. + ''' + return self.unique_name + @loggable @property def display_name(self): @@ -2003,17 +1937,6 @@ def run_complete(self): return self._job.finished() - @final - def poll(self): - '''See :func:`run_complete`. - - .. deprecated:: 3.2 - - ''' - user_deprecation_warning('calling poll() is deprecated; ' - 'please use run_complete() instead') - return self.run_complete() - @final def run_wait(self): '''Wait for the run phase of this test to finish. @@ -2034,16 +1957,6 @@ def run_wait(self): ''' self._job.wait() - @final - def wait(self): - '''See :func:`run_wait`. - - .. deprecated:: 3.2 - ''' - user_deprecation_warning('calling wait() is deprecated; ' - 'please use run_wait() instead') - self.run_wait() - @final def sanity(self): self.check_sanity() @@ -2317,42 +2230,6 @@ def cleanup(self, remove_files=False): def user_deps(self): return util.SequenceView(self._userdeps) - def _depends_on_func(self, how, subdeps=None, *args, **kwargs): - if args or kwargs: - raise ValueError('invalid arguments passed') - - user_deprecation_warning("passing 'how' as an integer or passing " - "'subdeps' is deprecated; please have a " - "look at the user documentation") - - if (subdeps is not None and - not isinstance(subdeps, typ.Dict[str, typ.List[str]])): - raise TypeError("subdeps argument must be of type " - "`Dict[str, List[str]]' or `None'") - - # Now return a proper when function - def exact(src, dst): - if not subdeps: - return False - - p0, e0 = src - p1, e1 = dst - - # DEPEND_EXACT allows dependencies inside the same partition - return ((p0 == p1) and (e0 in subdeps) and (e1 in subdeps[e0])) - - # Follow the old definitions - # DEPEND_BY_ENV used to mean same env and same partition - if how == DEPEND_BY_ENV: - return udeps.by_case - # DEPEND_BY_ENV used to mean same partition - elif how == DEPEND_FULLY: - return udeps.by_part - elif how == DEPEND_EXACT: - return exact - else: - raise ValueError(f"unknown value passed to 'how' argument: {how}") - def depends_on(self, target, how=None, *args, **kwargs): '''Add a dependency to another test. @@ -2412,15 +2289,13 @@ def by_part(src, dst): Passing an integer to the ``how`` argument as well as using the ``subdeps`` argument is deprecated. + .. versionchanged:: 4.0.0 + Passing an integer to the ``how`` argument is no longer supported. + ''' if not isinstance(target, str): raise TypeError("target argument must be of type: `str'") - if (isinstance(how, int)): - # We are probably using the old syntax; try to get a - # proper how function - how = self._depends_on_func(how, *args, **kwargs) - if how is None: how = udeps.by_case diff --git a/reframe/core/schedulers/__init__.py b/reframe/core/schedulers/__init__.py index ccc629fdc6..7423a68736 100644 --- a/reframe/core/schedulers/__init__.py +++ b/reframe/core/schedulers/__init__.py @@ -258,7 +258,7 @@ class Job(jsonext.JSONSerializable, metaclass=JobMeta): #: #: from reframe.core.backends import getlauncher #: - #: @rfm.run_after('setup') + #: @run_after('setup') #: def set_launcher(self): #: self.job.launcher = getlauncher('local')() #: diff --git a/reframe/core/systems.py b/reframe/core/systems.py index 4a5d4682d4..d145f2bc99 100644 --- a/reframe/core/systems.py +++ b/reframe/core/systems.py @@ -327,20 +327,6 @@ def launcher_type(self): ''' return self._launcher_type - @property - def launcher(self): - '''See :attr:`launcher_type`. - - .. deprecated:: 3.2 - Please use :attr:`launcher_type` instead. - ''' - - from reframe.core.warnings import user_deprecation_warning - - user_deprecation_warning("the 'launcher' attribute is deprecated; " - "please use 'launcher_type' instead") - return self.launcher_type - def get_resource(self, name, **values): '''Instantiate managed resource ``name`` with ``value``. diff --git a/reframe/utility/__init__.py b/reframe/utility/__init__.py index 0358c525c2..006a363234 100644 --- a/reframe/utility/__init__.py +++ b/reframe/utility/__init__.py @@ -609,7 +609,7 @@ def find_modules(substr, environ_mapping=None): class MyTest(rfm.RegressionTest): module_info = parameter(find_modules('netcdf')) - @rfm.run_after('init') + @run_after('init') def apply_module_info(self): s, e, m = self.module_info self.valid_systems = [s] @@ -635,7 +635,7 @@ def apply_module_info(self): class MyTest(rfm.RegressionTest): module_info = parameter(my_find_modules('GROMACS')) - @rfm.run_after('init') + @run_after('init') def apply_module_info(self): s, e, m = self.module_info self.valid_systems = [s] diff --git a/reframe/utility/sanity.py b/reframe/utility/sanity.py index 918d38cc68..bd66bd03a4 100644 --- a/reframe/utility/sanity.py +++ b/reframe/utility/sanity.py @@ -13,7 +13,6 @@ import sys import reframe.utility as util -import reframe.core.warnings as warn from reframe.core.deferrable import (deferrable, _DeferredExpression, _DeferredPerformanceExpression) from reframe.core.exceptions import SanityError @@ -64,16 +63,6 @@ def make_performance_function(func, unit, *args, **kwargs): return _DeferredPerformanceExpression(func, unit, *args, **kwargs) -# Create an alias decorator -def sanity_function(func): - warn.user_deprecation_warning( - 'using the @sn.sanity_function decorator from the sn module is ' - 'deprecated; please use the built-in decorator @deferrable instead.', - from_version='3.8.0' - ) - return deferrable(func) - - # Deferrable versions of selected builtins @deferrable diff --git a/reframe/utility/versioning.py b/reframe/utility/versioning.py index f4ff8774fc..a0291edc63 100644 --- a/reframe/utility/versioning.py +++ b/reframe/utility/versioning.py @@ -7,42 +7,8 @@ import re import semver -from reframe.core.warnings import user_deprecation_warning - -def parse(version_str): - '''Compatibility function to normalize version strings from prior - ReFrame versions - - :returns: a :class:`semver.VersionInfo` object. - ''' - - compat = False - old_style_stable = re.search(r'^(\d+)\.(\d+)$', version_str) - old_style_dev = re.search(r'(\d+)\.(\d+)((\d+))?-dev(\d+)$', version_str) - if old_style_stable: - compat = True - major = old_style_stable.group(1) - minor = old_style_stable.group(2) - ret = semver.VersionInfo(major, minor, 0) - elif old_style_dev: - compat = True - major = old_style_dev.group(1) - minor = old_style_dev.group(2) - patchlevel = old_style_dev.group(4) or 0 - prerelease = old_style_dev.group(5) - ret = semver.VersionInfo(major, minor, patchlevel, f'dev.{prerelease}') - else: - ret = semver.VersionInfo.parse(version_str) - - if compat: - user_deprecation_warning( - f"the version string {version_str!r} is deprecated; " - f"please use the conformant '{ret}'", - from_version='3.5.0' - ) - - return ret +parse = semver.VersionInfo.parse class _ValidatorImpl(abc.ABC): diff --git a/unittests/resources/checks_unlisted/no_required_version.py b/unittests/resources/checks_unlisted/no_required_version.py deleted file mode 100644 index 5785441d21..0000000000 --- a/unittests/resources/checks_unlisted/no_required_version.py +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright 2016-2022 Swiss National Supercomputing Centre (CSCS/ETH Zurich) -# ReFrame Project Developers. See the top-level LICENSE file for details. -# -# SPDX-License-Identifier: BSD-3-Clause - -import reframe as rfm - - -@rfm.required_version() -@rfm.simple_test -class SomeTest(rfm.RegressionTest): - pass diff --git a/unittests/test_containers.py b/unittests/test_containers.py index 6573bdeca0..6518781cb2 100644 --- a/unittests/test_containers.py +++ b/unittests/test_containers.py @@ -6,7 +6,6 @@ import pytest import reframe.core.containers as containers -import reframe.core.warnings as warn @pytest.fixture(params=[ @@ -270,16 +269,6 @@ def expected_run_with_workdir(container_variant_noopt): '--foo image:tag cmd1') -def test_run_with_commands(container_platform_with_opts, - expected_run_with_commands): - container_platform_with_opts.workdir = None - with pytest.warns(warn.ReframeDeprecationWarning): - container_platform_with_opts.commands = ['cmd1', 'cmd2'] - - found_commands = container_platform_with_opts.launch_command('/foo') - assert found_commands == expected_run_with_commands - - def test_run_with_workdir(container_platform_with_opts, expected_run_with_workdir): container_platform_with_opts.command = 'cmd1' diff --git a/unittests/test_deferrable.py b/unittests/test_deferrable.py index 5c54e831fd..5c34aac9eb 100644 --- a/unittests/test_deferrable.py +++ b/unittests/test_deferrable.py @@ -4,9 +4,7 @@ # SPDX-License-Identifier: BSD-3-Clause import pytest -import reframe.core.warnings as warnings import reframe.utility.sanity as sn -from reframe.core.warnings import ReframeDeprecationWarning def test_defer(): @@ -75,14 +73,6 @@ def my_expr(): assert expr.evaluate() == 3 -def test_depr_warn(monkeypatch): - monkeypatch.setattr(warnings, '_RAISE_DEPRECATION_ALWAYS', True) - with pytest.warns(ReframeDeprecationWarning): - @sn.sanity_function - def foo(): - pass - - def test_implicit_eval(): # Call to bool() on a deferred expression triggers its immediate # evaluation. diff --git a/unittests/test_dependencies.py b/unittests/test_dependencies.py index 290668102a..210722dbaa 100644 --- a/unittests/test_dependencies.py +++ b/unittests/test_dependencies.py @@ -11,13 +11,11 @@ import reframe.frontend.dependencies as dependencies import reframe.frontend.executors as executors import reframe.utility as util -import reframe.utility.sanity as sn import reframe.utility.udeps as udeps import unittests.utility as test_util from reframe.core.environments import Environment from reframe.core.exceptions import DependencyError -from reframe.core.warnings import ReframeDeprecationWarning from reframe.frontend.loader import RegressionCheckLoader @@ -319,60 +317,6 @@ def test_dependecies_how_functions_undoc(): assert len(deps) == 9 -def test_build_deps_deprecated_syntax(loader, default_exec_ctx): - class Test0(rfm.RegressionTest): - valid_systems = ['sys0:p0', 'sys0:p1'] - valid_prog_environs = ['e0', 'e1'] - executable = 'echo' - sanity_patterns = sn.assert_true(1) - - class Test1_deprecated(rfm.RunOnlyRegressionTest): - kind = parameter([rfm.DEPEND_FULLY, - rfm.DEPEND_BY_ENV, - rfm.DEPEND_EXACT]) - - def __init__(self): - self.valid_systems = ['sys0:p0', 'sys0:p1'] - self.valid_prog_environs = ['e0', 'e1'] - self.executable = 'echo' - self.executable_opts = [self.name] - if self.kind == rfm.DEPEND_EXACT: - self.depends_on('Test0', self.kind, - {'e0': ['e0', 'e1'], 'e1': ['e1']}) - else: - self.depends_on('Test0', self.kind) - - # We will do our assertions in a post-init hook - - @run_after('init') - def assert_deps(self): - if self.kind == rfm.DEPEND_FULLY: - assert self._userdeps == [('Test0', udeps.by_part)] - elif self.kind == rfm.DEPEND_BY_ENV: - assert self._userdeps == [('Test0', udeps.by_case)] - else: - how = self._userdeps[0][1] - t0_cases = [(p, e) for p in ['p0', 'p1'] - for e in ['e0', 'e1']] - t1_cases = [(p, e) for p in ['p0', 'p1'] - for e in ['e0', 'e1']] - deps = {(t0, t1) for t0 in t0_cases - for t1 in t1_cases if how(t0, t1)} - assert deps == { - (t0, t1) for t0 in t0_cases - for t1 in t1_cases - if ((t0[0] == t1[0] and t0[1] == 'e0') or - (t0[0] == t1[0] and t0[1] == 'e1' and t1[1] == 'e1')) - } - assert len(deps) == 6 - - with pytest.warns(ReframeDeprecationWarning) as warnings: - for _id in range(Test1_deprecated.num_variants): - Test1_deprecated(variant_num=_id) - - assert len(warnings) == 3 - - def test_build_deps(loader, default_exec_ctx): checks = loader.load_all(force=True) diff --git a/unittests/test_loader.py b/unittests/test_loader.py index aa81836271..cd382298ba 100644 --- a/unittests/test_loader.py +++ b/unittests/test_loader.py @@ -9,7 +9,6 @@ import reframe as rfm from reframe.core.exceptions import ReframeSyntaxError -from reframe.core.warnings import ReframeDeprecationWarning from reframe.frontend.loader import RegressionCheckLoader @@ -69,12 +68,6 @@ def test_load_error(loader): loader.load_from_file('unittests/resources/checks/foo.py') -def test_load_bad_required_version(loader): - with pytest.warns(ReframeDeprecationWarning): - loader.load_from_file('unittests/resources/checks_unlisted/' - 'no_required_version.py') - - def test_load_bad_init(loader): tests = loader.load_from_file( 'unittests/resources/checks_unlisted/bad_init_check.py' @@ -147,10 +140,3 @@ def setup(self, partition, environ, **job_opts): class TestSpecialDerived(TestSpecial): def setup(self, partition, environ, **job_opts): super().setup(partition, environ, **job_opts) - - with pytest.warns(ReframeDeprecationWarning): - @rfm.simple_test - class TestFinal(rfm.RegressionTest): - @rfm.final - def my_new_final(self): - pass diff --git a/unittests/test_parameters.py b/unittests/test_parameters.py index 5cec18cda0..12938ad528 100644 --- a/unittests/test_parameters.py +++ b/unittests/test_parameters.py @@ -195,17 +195,6 @@ class MyTest(ExtendParams): assert test.P2 is not None -@pytest.mark.filterwarnings( - 'ignore::reframe.core.warnings.ReframeDeprecationWarning' -) -def test_parameterized_test_is_incompatible(): - with pytest.raises(ReframeSyntaxError): - @rfm.parameterized_test(['var']) - class MyTest(TwoParams): - def __init__(self, var): - pass - - def test_param_space_clash(): class Spam(rfm.RegressionMixin): P0 = parameter([1]) diff --git a/unittests/test_pipeline.py b/unittests/test_pipeline.py index 8ef7818bed..0c7c358b0b 100644 --- a/unittests/test_pipeline.py +++ b/unittests/test_pipeline.py @@ -1892,27 +1892,3 @@ def set_defaults(self): x = _X() assert x.foo == 10 assert x.bar == 100 - - -def test_set_name_deprecation(): - from reframe.core.warnings import ReframeDeprecationWarning - - with pytest.warns(ReframeDeprecationWarning): - class _X(rfm.RegressionTest): - @run_after('init') - def set_name(self): - self.name = 'foo' - - x = _X() - - assert x.name == 'foo' - assert x.unique_name == 'foo' - - with pytest.warns(ReframeDeprecationWarning): - class _X(rfm.RegressionTest): - name = 'foo' - - x = _X() - - assert x.name == 'foo' - assert x.unique_name == 'foo' diff --git a/unittests/test_versioning.py b/unittests/test_versioning.py index 0148f48657..1a15b13e8f 100644 --- a/unittests/test_versioning.py +++ b/unittests/test_versioning.py @@ -4,7 +4,6 @@ # SPDX-License-Identifier: BSD-3-Clause import pytest -import reframe.core.warnings as warnings import reframe.utility.versioning as versioning @@ -42,20 +41,3 @@ def test_version_validation(): with pytest.raises(ValueError): versioning.VersionValidator('>1') - - -def test_parse(monkeypatch): - monkeypatch.setattr(warnings, '_RAISE_DEPRECATION_ALWAYS', True) - with pytest.warns(warnings.ReframeDeprecationWarning, - match="please use the conformant '3.5.0'"): - deprecated = versioning.parse('3.5') - - assert deprecated == versioning.parse('3.5.0') - with pytest.warns(warnings.ReframeDeprecationWarning, - match="please use the conformant '3.5.0-dev.0'"): - deprecated = versioning.parse('3.5-dev0') - - assert deprecated == versioning.parse('3.5.0-dev.0') - assert str(versioning.parse('3.5.0')) == '3.5.0' - assert str(versioning.parse('3.5.0-dev.1')) == '3.5.0-dev.1' - assert str(versioning.parse('3.5.0-dev.1+HASH')) == '3.5.0-dev.1+HASH'