Skip to content

chore(bigquery): add dynamic logging banner to nox mypy session#17492

Draft
chalmerlowe wants to merge 2 commits into
mainfrom
feat/bigquery-mypy-banner
Draft

chore(bigquery): add dynamic logging banner to nox mypy session#17492
chalmerlowe wants to merge 2 commits into
mainfrom
feat/bigquery-mypy-banner

Conversation

@chalmerlowe

Copy link
Copy Markdown
Contributor

This PR adds a dynamic logging banner
Finished session for <package>
to nox mypy sessions in bigquery to simplify troubleshooting.

Currently when a nox session runs, there may be many lines of text between a reference to which package is being tested and the result summary line. This can make it more difficult to determine which package is affected without a lot of manual scrolling (every time you need to trouble shoot an issue). This is especially true if you use Ctrl+F to zoom over to summaries with words like failed.

change detected in packages/bigframes/
[many lines of text...]
2547 passed, 157 skipped, 9 xfailed, 1 xpassed, 586 warnings in 136.68s (0:02:16)
nox > Session unit-3.11(test_extra=True) failed in 3 minutes.

The PR adds a banner line right before the nox result summary:

change detected in packages/bigframes/
[many lines of text...]
2547 passed, 157 skipped, 9 xfailed, 1 xpassed, 586 warnings in 136.68s (0:02:16)
nox > Finished session for bigframes      # NEW LINE, right before the summary line
nox > Session unit-3.11(test_extra=True) failed in 3 minutes.

Note: There is no convenient way to inject a log line into the nox session and have it print exactly where you want to AND ideally, this feature would be included in all nox sessions, so I included a contextmanager to ensure the correct placement of the new logging banner.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a log_package_context context manager in noxfile.py to log a package context banner upon Nox session completion, applying it to the mypy session. The feedback suggests replacing os.getcwd() with pathlib.Path(file).parent.name to ensure the package name is correctly resolved even when Nox is executed from outside the package directory.

Comment thread packages/google-cloud-bigquery/noxfile.py Outdated
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.

1 participant