diff --git a/lib/ramble/ramble/application.py b/lib/ramble/ramble/application.py index a98d66f6b..fbe9f2e33 100644 --- a/lib/ramble/ramble/application.py +++ b/lib/ramble/ramble/application.py @@ -846,25 +846,6 @@ def validate_experiment(self): # Validate the new modifiers variables exist # (note: the base ramble variables are checked earlier too) self.keywords.check_required_keys(self.variables) - self._validate_objects() - - def _validate_objects(self): - required_self_attrs = ["name"] - - def is_attr_self_defined(obj, attr): - # Use the low level __dict__ to exclude inherited class attrs - return attr in obj.__class__.__dict__ - - objs = [self, *self._modifier_instances] - if self.package_manager is not None: - objs.append(self.package_manager) - for req_attr in required_self_attrs: - for obj in objs: - if not is_attr_self_defined(obj, req_attr): - raise ApplicationError( - f"Object class {obj.__class__.__name__} is missing " - f"required attribute '{req_attr}'" - ) def _define_custom_executables(self): # Define custom executables diff --git a/lib/ramble/ramble/test/end_to_end/required_attributes.py b/lib/ramble/ramble/test/end_to_end/required_attributes.py deleted file mode 100644 index 047779d00..000000000 --- a/lib/ramble/ramble/test/end_to_end/required_attributes.py +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright 2022-2025 The Ramble Authors -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -import os - -import pytest - -import ramble.workspace -import ramble.config -from ramble.main import RambleCommand -from ramble.application import ApplicationError - - -pytestmark = pytest.mark.usefixtures("mutable_config", "mutable_mock_workspace_path") - -workspace = RambleCommand("workspace") - - -def test_object_validation(mock_applications): - test_config = """ -ramble: - variables: - mpi_command: 'mpirun -n {n_ranks} -ppn {processes_per_node}' - batch_submit: 'batch_submit {execute_experiment}' - partition: 'part1' - processes_per_node: '1' - n_threads: '1' - applications: - basic-inherited-noname: - workloads: - test_wl: - experiments: - simple_test: - variables: - n_nodes: 1 - software: - packages: {} - environments: {} -""" - ws_name = "test_object_validation" - with ramble.workspace.create(ws_name) as ws: - ws.write() - - config_path = os.path.join(ws.config_dir, ramble.workspace.config_file_name) - - with open(config_path, "w+") as f: - f.write(test_config) - ws._re_read() - with pytest.raises( - ApplicationError, - match="Object class BasicInheritedNoname is missing required attribute 'name'", - ): - workspace("setup", "--dry-run", global_args=["-w", ws_name]) diff --git a/var/ramble/repos/builtin.mock/applications/basic-inherited-noname/application.py b/var/ramble/repos/builtin.mock/applications/basic-inherited-noname/application.py deleted file mode 100644 index e6257b6f5..000000000 --- a/var/ramble/repos/builtin.mock/applications/basic-inherited-noname/application.py +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright 2022-2025 The Ramble Authors -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -from ramble.appkit import * - -from ramble.app.builtin.mock.basic import Basic as BaseBasic - - -class BasicInheritedNoname(BaseBasic): - """An app that intentionally has no name attribute, for unit-test purpose.""" - - workload("test_wl_noname", executable="foo", input="inherited_input")