[enhancement] Improve programming error messages #3489
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR improves substantially the programming error messages in ReFrame in an attempt to help users when writing tests. More specifically, the reframe syntax errors are treated, which are those directly related to the special test syntax and were the most difficult to decipher.
The key challenge of such messages is that they are thrown raised class construction and not at the exact point where they are sourced. Although we could get precise line information for every variable, parameter and fixture definition and even every assignment in a test class, this would make loading of the tests prohibitively slow, as it requires stack inspection. Thus, for variables, parameters and fixtures we only store the name of the owner class, so that we can provide precise guidance to the user when error occurs. We also provide source code information for every reframe syntax error, but this is limited to the line where the class is defined.
Also all the syntax error messages where rephrased carefully taking the test developer's perspective. Some of them also contain suggestions on how to properly fix the code.
Closes #2308.
Todos