Skip to content

fix(spanner): fix TransactionPingingPool throwing error ''NoneType' object is not callable' - #9609

Merged
tseaver merged 6 commits into
googleapis:masterfrom
larkee:pinging-pool-fix
Nov 11, 2019
Merged

fix(spanner): fix TransactionPingingPool throwing error ''NoneType' object is not callable'#9609
tseaver merged 6 commits into
googleapis:masterfrom
larkee:pinging-pool-fix

Conversation

@larkee

Copy link
Copy Markdown
Contributor

TransactionPingingPool is throwing error ''NoneType' object is not callable' when trying to batch insert. This is the fix.

@larkeelarkee added the api: spanner Issues related to the Spanner API. label Nov 6, 2019
@larkee
larkee requested a review from crwilcoxNovember 6, 2019 09:21
@larkeelarkee self-assigned this Nov 6, 2019
@googlebotgooglebot added the cla: yes This human has signed the Contributor License Agreement. label Nov 6, 2019

@tseavertseaver 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.

Rather than tweak the hand-rolled _Transaction mock, let's take this as an opportunity to replace it with an "mock autospec" version, which will auttomatically keep the signatures correct.

@tseavertseaver added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 6, 2019
@yoshi-kokoroyoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 6, 2019
@larkee

Copy link
Copy Markdown
ContributorAuthor

The mock autospec does not support static attributes which causes test_put_non_full_w_active_txn to fail because txn.committed is a NonCallableMagicMock, not None. I don't see an easy fix for that.

Perhaps, it would be easier to go with the original change and have this refactor in a subsequent PR?

@tseaver

Copy link
Copy Markdown
Contributor

@larkee Hmm, odd: I pasted in that change after making it locally, and got all the tests to pass. Nevertheless, we can update the _make_transaction() factory to assign txn.committed = None (which is an appropriate initial condition).

@larkee
larkee requested a review from tseaverNovember 8, 2019 03:45
@larkee

Copy link
Copy Markdown
ContributorAuthor

@tseaver PTAL

@tseaver
tseaver merged commit 20ff981 into googleapis:masterNov 11, 2019
@larkee
larkee deleted the pinging-pool-fix branch November 11, 2019 23:43
parthea pushed a commit that referenced this pull request Mar 9, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: spannerIssues related to the Spanner API.cla: yesThis human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@larkee@tseaver@googlebot@yoshi-kokoro