Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add short test summary info result message #150

Merged
merged 1 commit into from Dec 31, 2023
Merged

Conversation

hirotoKirimaru
Copy link
Contributor

@hirotoKirimaru hirotoKirimaru commented Dec 30, 2023

Fixes #133

add additional info to short test summary info.
The message is FAILURES's first message.

I believe that even if there are multiple error messages, it is sufficient if even one is displayed in the short message

FAILURE: check 1 == 2: comment about a=1 != b=2
============================= test session starts ==============================
platform linux -- Python 3.7.9, pytest-7.4.3, pluggy-1.2.0
rootdir: /tmp/pytest-of-mizubuntu/pytest-75/test_message0
plugins: check-2.2.2
collected 2 items / 1 deselected / 1 selected

test_example_short_test_summary_info.py F                                [100%]

=================================== FAILURES ===================================
_________________________________ test_message _________________________________

FAILURE: check 1 == 2: comment about a=1 != b=2
test_example_short_test_summary_info.py:11 in test_message() -> check.equal(a, b, f"comment about a={a} != b={b}")

------------------------------------------------------------
Failed Checks: 1
=========================== short test summary info ============================
FAILED test_example_short_test_summary_info.py::test_message - FAILURE: check...
======================= 1 failed, 1 deselected in 0.55s ========================

@okken
Copy link
Owner

okken commented Dec 31, 2023

@hirotoKirimaru This is cool. Thanks for working on this.
I'd like to play with the formatting a little.
Are you ok with me adding modifications and pushing to this PR?

@hirotoKirimaru
Copy link
Contributor Author

@hirotoKirimaru This is cool. Thanks for working on this. I'd like to play with the formatting a little. Are you ok with me adding modifications and pushing to this PR?

@okken Absolutely, I have no problems with you making modifications and pushing to this PR.

@okken
Copy link
Owner

okken commented Dec 31, 2023

I modified the summary to remove the 'FAILURE:' from the front.
It's kinda of a hack bit of code, but I was hoping to have it similar to the assert summary.
I'm guessing there's a more elegant way to do this. But this seemed the most obvious to me.

I added assert tests to the example, for comparison:

=================================== short test summary info ===================================
FAILED test_example_summary.py::test_assert_no_msg - assert 1 == 2
FAILED test_example_summary.py::test_assert_msg - AssertionError: comment about a=1 != b=2
FAILED test_example_summary.py::test_check_no_msg - check 1 == 2
FAILED test_example_summary.py::test_check_msg - check 1 == 2: comment about a=1 != b=2

Look ok?

@okken
Copy link
Owner

okken commented Dec 31, 2023

Ok. I think I don't know what I'm doing with pushing to a PR. So I'm just gonna merge this and then merge my changes on top, and we can start fresh there.

@okken okken merged commit fce78e3 into okken:main Dec 31, 2023
5 checks passed
@okken
Copy link
Owner

okken commented Dec 31, 2023

Published as version 2.2.3

@hirotoKirimaru
Copy link
Contributor Author

Thank you for merging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: own error message for showing in a short test summary info
2 participants