Skip to content

Always show full comparison output if on CI. #1314

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

Merged
merged 1 commit into from
Jan 11, 2016
Merged

Always show full comparison output if on CI. #1314

merged 1 commit into from
Jan 11, 2016

Conversation

The-Compiler
Copy link
Member

When you don't get enough information with a test running on a CI, it's quite
frustrating, for various reasons:

  • It's more likely to be a flaky test, so you might not be able to reproduce
    the failure.
  • Passing -vv is quite bothersome (creating a temporary commit and reverting
    it)

For those reasons, if something goes wrong on CI, it's good to have as much
information as possible.

@@ -113,7 +115,8 @@ def callbinrepr(op, left, right):
for new_expl in hook_result:
if new_expl:
if (sum(len(p) for p in new_expl[1:]) > 80*8
and item.config.option.verbose < 2):
Copy link
Member

Choose a reason for hiding this comment

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

i think its time to factor that into a _format_expl(lines, verbose) function and invoke it before fixing the rewrite mod changes

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't get what you mean with "before fixing the rewrite mod changes".

And I have to disagree - callbinrepr doesn't seem very long as-is, and moving the stuff under if new_expl to a new function (if that's what you propose) doesn't really change much, IMHO.

Copy link
Member

Choose a reason for hiding this comment

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

IMO, if anything (and this is nitpick), I would move the sum(len(p) for p in new_expl[1:]) > 80*8 expression into a local variable expression_too_long for legibility... but as I said, really minor and doesn't block this PR. 😁

@nicoddemus
Copy link
Member

Cool, good idea! I'm all in favor of pytest being "smart" and display a better behavior when running on a CI server.

@nicoddemus
Copy link
Member

If CI and BUILD_NUMBER cover most CIs out there, I'm +1 on this! Thanks @The-Compiler!

@@ -26,6 +26,10 @@
including removal of the obsolete ``_pytest.assertion.oldinterpret`` module.
Thanks `@nicoddemus`_ for the PR (`#1226`_).

* Comparisons now always show up in full when 'CI' is found in the environment,
Copy link
Member

Choose a reason for hiding this comment

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

@The-Compiler you think we should also mention that BUILD_NUMBER is considered, or be a little vague instead and mention "in Continuous Integration environments" instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

Better to be explicit as long as it's only two variables anyways 😉 Changed.

When you don't get enough information with a test running on a CI, it's quite
frustrating, for various reasons:

- It's more likely to be a flaky test, so you might not be able to reproduce
  the failure.
- Passing -vv is quite bothersome (creating a temporary commit and reverting
  it)

For those reasons, if something goes wrong on CI, it's good to have as much
information as possible.
RonnyPfannschmidt added a commit that referenced this pull request Jan 11, 2016
Always show full comparison output if on CI.
@RonnyPfannschmidt RonnyPfannschmidt merged commit bc32e45 into pytest-dev:features Jan 11, 2016
davidszotten added a commit to davidszotten/pytest that referenced this pull request Aug 19, 2021
follow-up to pytest-dev#1314, for similar reasons

closes pytest-dev#9023
hoefling pushed a commit to hoefling/pytest that referenced this pull request Oct 22, 2021

Verified

This commit was signed with the committer’s verified signature.
hoefling Oleg Höfling
follow-up to pytest-dev#1314, for similar reasons

closes pytest-dev#9023
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.

None yet

3 participants