Skip to content

Error in execution order of hooks within same stage in same class #2284

@mahendrapaipuri

Description

@mahendrapaipuri

This simple test fails giving an attribute error error:

@rfm.simple_test
class Test(rfm.RunOnlyRegressionTest):
    valid_systems = ['*']
    valid_prog_environs = ['*']

    @run_after('setup')
    def set_var_a(self):
        self.a = 1

    @run_after('setup')
    def set_tags(self):
        self.tags |= {
            f'a={self.a}',
        }

The debug info is:

------------------------------------------------------------------------------
FAILURE INFO for Test 
  * Test Description: Test
  * System partition: generic:default1
  * Environment: builtin
  * Stage directory: /Users/mahendrapaipuri/Documents/IR_INRIA/Scripts/ReFrame/stage/generic/default1/builtin/Test
  * Node list: 
  * Job type: local (id=None)
  * Dependencies (conceptual): []
  * Dependencies (actual): []
  * Maintainers: []
  * Failing phase: setup
  * Rerun with '-n Test -p builtin --system generic:default1 -r'
  * Reason: attribute error: exec_order.py:65: 'Test' object has no attribute 'a'
            f'a={self.a}',

Traceback (most recent call last):
  File "/Users/mahendrapaipuri/Documents/IR_INRIA/Scripts/ReFrame/reframe/reframe/frontend/executors/__init__.py", line 267, in _safe_call
    return fn(*args, **kwargs)
  File "/Users/mahendrapaipuri/Documents/IR_INRIA/Scripts/ReFrame/reframe/reframe/core/hooks.py", line 82, in _fn
    getattr(obj, h.__name__)()
  File "/Users/mahendrapaipuri/Documents/IR_INRIA/Scripts/ReFrame/reframe/reframe/core/hooks.py", line 32, in _fn
    func(*args, **kwargs)
  File "/Users/mahendrapaipuri/Documents/IR_INRIA/Scripts/ReFrame/exec_order.py", line 65, in set_tags
    f'a={self.a}',
  File "/Users/mahendrapaipuri/Documents/IR_INRIA/Scripts/ReFrame/reframe/reframe/core/pipeline.py", line 1024, in __getattr__
    raise AttributeError(
AttributeError: 'Test' object has no attribute 'a'

------------------------------------------------------------------------------

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions