Thanks to visit codestin.com
Credit goes to github.com

Skip to content

More precise logging in CI #734

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 16, 2025
Merged

More precise logging in CI #734

merged 1 commit into from
Jan 16, 2025

Conversation

dandavison
Copy link
Contributor

@dandavison dandavison commented Jan 16, 2025

In general, CI test logs should:

  • Make it easy to see which tests have failed

  • Help understand how they have failed

To that end, they should:

  • Include minimal output for tests that pass

  • Include full output for tests that fail (should not be many)

Previously we were using pytest's log-cli feature, which outputs logs for all tests as the tests are run. This PR stops using that, instead switching to a config that outputs all logging output >= DEBUG for failed tests, at the end of the test run (search for =================================== FAILURES ===================================).

See https://docs.pytest.org/en/stable/how-to/logging.html#logging.

@dandavison dandavison requested a review from a team as a code owner January 16, 2025 18:10
Copy link
Member

@Sushisource Sushisource left a comment

Choose a reason for hiding this comment

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

Are you telling me we overrode the default behavior in favor of the worse option?

🙏 yay for the change

@dandavison
Copy link
Contributor Author

Are you telling me we overrode the default behavior in favor of the worse option?

I'd say so. Maybe it wasn't as bad in the early days of the repo.

@dandavison dandavison force-pushed the more-precise-ci-logging branch from 44a54da to 16855fa Compare January 16, 2025 19:08
@dandavison dandavison force-pushed the more-precise-ci-logging branch from 16855fa to 9cbf307 Compare January 16, 2025 19:23
Copy link
Member

@cretz cretz left a comment

Choose a reason for hiding this comment

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

Nothing blocking

Comment on lines -108 to +111
log_cli = true
log_cli_level = "INFO"
log_cli_format = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)"
# Do not use log_cli since this shows logging for all tests, not just the ones
# that failed. Instead, show all logs for failed tests at the end.
log_level = "DEBUG"
log_format = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)"
Copy link
Member

Choose a reason for hiding this comment

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

Near the bottom of the README there is:

For example, here's how to run a single test with debug logs on the console:

    poe test -s --log-cli-level=DEBUG -k test_sync_activity_thread_cancel_caught

I admit I use this a lot during development on passing tests (I put this at the bottom of the README on .NET and Ruby too because I forget the args going from one to the other). Will this still work or does this need to be updated now to enable CLI logging?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That still works:
image

@dandavison dandavison merged commit 1a68b58 into main Jan 16, 2025
14 checks passed
@dandavison dandavison deleted the more-precise-ci-logging branch January 16, 2025 20:25
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.

3 participants