Skip to content

Improve output of styletest on failure#22515

Merged
branfosj merged 5 commits intoeasybuilders:developfrom
Flamefire:improve-styletest-output
Jun 1, 2025
Merged

Improve output of styletest on failure#22515
branfosj merged 5 commits intoeasybuilders:developfrom
Flamefire:improve-styletest-output

Conversation

@Flamefire
Copy link
Copy Markdown
Contributor

Just show the error on failure not e.g. "1 != 0"

The current output isn't easy to read. Example:

FAIL: test_style_conformance (test.easyconfigs.styletests.StyleTest)
Check the easyconfigs for style
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.7.17/x64/lib/python3.7/site-packages/easybuild/base/testing.py", line 97, in assertEqual
    super(TestCase, self).assertEqual(a, b)
  File "/opt/hostedtoolcache/Python/3.7.17/x64/lib/python3.7/unittest/case.py", line 852, in assertEqual
    assertion_func(first, second, msg=msg)
AssertionError: 1 != 0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/runner/work/easybuild-easyconfigs/easybuild-easyconfigs/test/easyconfigs/styletests.py", line 68, in test_style_conformance
    self.assertEqual(result, 0, error_msg)
  File "/opt/hostedtoolcache/Python/3.7.17/x64/lib/python3.7/site-packages/easybuild/base/testing.py", line 119, in assertEqual
    raise AssertionError("%s:\nDIFF%s:\n%s" % (msg, limit, ''.join(diff[:self.ASSERT_MAX_DIFF])))
AssertionError: There shouldn't be any code style errors (and/or warnings), found 1:
/home/runner/work/easybuild-easyconfigs/easybuild-easyconfigs/easybuild/easyconfigs/u/UFL/UFL-2024.2.0-gfbf-2023b.eb:31:17: E221 multiple spaces before operator

: 1 != 0:
DIFF:
- 1

@branfosj branfosj added this to the next release (5.1.1?) milestone Jun 1, 2025
@branfosj branfosj merged commit d47a75e into easybuilders:develop Jun 1, 2025
8 checks passed
@Flamefire Flamefire deleted the improve-styletest-output branch June 1, 2025 12:29
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