test(bigquery-magics): make table_id parsing check version-agnostic#17562
Open
chalmerlowe wants to merge 5 commits into
Open
test(bigquery-magics): make table_id parsing check version-agnostic#17562chalmerlowe wants to merge 5 commits into
chalmerlowe wants to merge 5 commits into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates a unit test assertion in test_bigquery.py to check for the presence of 'table_id' instead of 'must be a fully-qualified ID' in the error output. There are no review comments, and I have no feedback to provide.
chalmerlowe
commented
Jun 24, 2026
chalmerlowe
commented
Jun 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
These changes are at a high level unrelated. They are being submitted as a single corrective action. Separating them leads to a chicken or the egg set of failures (i.e. no one PR will pass all CI/CD tests with out the other changes).
test(bigquery-magics): make table_id parsing check version-agnostic
The unit test
test_bigquery_magic_query_variable_not_identifierwas asserting that a specific error message ("must be a fully-qualified ID") was in the stderr output.However, in a recent versions of dependencies, this error message changed (depending on whether tests were run under Python 3.10 or 3.11+). There is a key term that is common to both of the error messages:
table_id.This change confirms that we get one of the two expected error messages by checking for
table_id, making it compatible regardless of which runtime the tests run under.refactor(magics): replace fragile psutil socket check with client close mock spy
The system test
test_bigquery_magicwas usingpsutilto count open sockets before and after the test to detect leaks (i.e. ensure all the system resources were released).This approach proved to be fragile across different environments (e.g., Kokoro).
This change replaces the socket counting with a mock spy on
google.cloud.bigquery.Client.closeto verify that the client is explicitly closed, which is the intended mechanism for releasing system resources.test(bigquery-magics): simplify IPython initialization in deprecation test
The unit test
test_cell_magic_engine_bigframes_warningintest_deprecation.pywas conditionally initializing IPython. Only one of the code paths was being exercised so we were getting a coverage issue.This change simplifies the initialization by unconditionally calling
start_ipython()and assigning the returned instance toipensuring a clean and consistent state for the test and avoiding the need for a conditional check.