Skip to content

Conversation

Flamefire
Copy link
Contributor

We no longer need this custom function with Python 2 support being dropped.

The only remaining use case was EasyBuildError where str(e) didn't return the error as a string but as an escaped string.

See also #5009 which fixes that (single relevant commit included here to avoid test failures)

This makes it easier to use, especially for new devs being used to the unittest module and conventions for other functions like self.assertRaises.

Additionally this can be used as a context manager:

with self.assertRaises(TypeError): # similar for assertRaisesRegex
  do_this()
  do_that()

@Flamefire Flamefire force-pushed the replace-assertErrorRegex branch 2 times, most recently from 362f231 to 6d93182 Compare September 29, 2025 08:33
@Flamefire Flamefire force-pushed the replace-assertErrorRegex branch from 6d93182 to 35125ac Compare September 29, 2025 10:35

def __str__(self):
"""Return string representation of this EasyBuildError instance."""
return repr(self.msg)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This includes the changes from #5009 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. Otherwise tests fail due to escaping as we had special handling for that, see convert_exception_to_str

@boegel boegel added the tests label Oct 8, 2025
@boegel boegel added this to the next release (5.2.0?) milestone Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants