Skip to content
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

tests: allow prerelease dependency versions under Python 3.9 #479

Merged
merged 7 commits into from
Aug 12, 2021

Conversation

tseaver
Copy link
Contributor

@tseaver tseaver commented Aug 6, 2021

Also, drop use of 'pytz', which is no longer depended on by google-api-core / google-cloud-core.

Instead, use either datetime.timezone.utc or google.cloud._helpers.UTC, depending on usage.

@tseaver tseaver requested review from crwilcox and larkee August 6, 2021 21:54
@tseaver tseaver requested a review from a team as a code owner August 6, 2021 21:54
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Aug 6, 2021
@product-auto-label product-auto-label bot added the api: spanner Issues related to the googleapis/python-spanner API. label Aug 6, 2021
tseaver added a commit that referenced this pull request Aug 6, 2021
@tseaver tseaver added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 9, 2021
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 9, 2021
@tseaver
Copy link
Contributor Author

tseaver commented Aug 9, 2021

The error here is because we patch time.time, which ends up being called more than once because OT is emitting an unexpected warning message:

google/cloud/spanner_v1/session.py:371: in run_in_transaction
    txn.commit(
google/cloud/spanner_v1/transaction.py:161: in commit
    with trace_call("CloudSpanner.Commit", self._session, trace_attributes):
/usr/local/lib/python3.9/contextlib.py:117: in __enter__
    return next(self.gen)
google/cloud/spanner_v1/_opentelemetry_tracing.py:55: in trace_call
    span.set_status(Status(StatusCode.OK))
.nox/unit-3-9/lib/python3.9/site-packages/opentelemetry/trace/status.py:57: in __init__
    logger.warning(
/usr/local/lib/python3.9/logging/__init__.py:1446: in warning
    self._log(WARNING, msg, args, **kwargs)
/usr/local/lib/python3.9/logging/__init__.py:1575: in _log
    record = self.makeRecord(self.name, level, fn, lno, msg, args,
/usr/local/lib/python3.9/logging/__init__.py:1544: in makeRecord
    rv = _logRecordFactory(name, level, fn, lno, msg, args, exc_info, func,
/usr/local/lib/python3.9/logging/__init__.py:283: in __init__
    ct = time.time()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    def _time(_results=[1, 1.5]):
>       return _results.pop(0)
E       IndexError: pop from empty list

tests/unit/test_session.py:1192: IndexError
------------------------------ Captured log call -------------------------------
WARNING  opentelemetry.trace.status:status.py:57 description should only be set when status_code is set to StatusCode.ERROR

We can clearly work around this issue by making our _time mock an infinite generator. However, I don't believe the traceback which triggered the error here. This line:

google/cloud/spanner_v1/_opentelemetry_tracing.py:55: in trace_call
    span.set_status(Status(StatusCode.OK))

clearly does not pass a non-default description to the Status constructor (which is what the warning is complaining about).

I wish there was a way for us to see the list of installed packages in the virtual environment.

Also, drop use of 'pytz', which is no longer depended on by 'google-api-core'
/ 'google-cloud-core'.  Instead, use either 'datetime.timezone.utc' or
'google.cloud._helpers.UTC', depending on usage.
@tseaver tseaver force-pushed the tests-allow-prerelease-deps-python39 branch from 7e2a985 to ef8561a Compare August 10, 2021 19:10
@tseaver tseaver requested a review from a team as a code owner August 10, 2021 20:43
larkee pushed a commit that referenced this pull request Aug 11, 2021
* tests: move instance API systests to own module

Refactor to use pytest fixtures / idioms, rather than old 'Config'
setup / teardown.

Toward #472.

* tests: move database API systests to own module

Refactor to use pytest fixtures / idioms, rather than old 'Config'
setup / teardown.

Toward #472.

* tests: move table API systests to own module

Refactor to use pytest fixtures / idioms, rather than old 'Config'
setup / teardown.

Toward #472.

* tests: move backup API systests to own module [WIP]

Refactor to use pytest fixtures / idioms, rather than old 'Config'
setup / teardown.

Toward #472.

* tests: move streaming/chunnking systests to own module

Refactor to use pytest fixtures / idioms, rather than old 'Config'
setup / teardown.

Toward #472.

* tests: move session API systests to own module

Refactor to use pytest fixtures / idioms, rather than old 'Config'
setup/ teardown.

Toward #472.

* tests: move dbapi systests to owwn module

Refactor to use pytest fixtures / idioms, rather than old 'Confog'
setup / teardown.

Toward #472.

* tests: remove legacy systest setup / teardown code

Closes #472.

* tests: don't pre-create datbase before restore attempt

* tests: fix instance config fixtures under emulator

* tests: clean up alt instnce at module scope

Avoids clash with 'test_list_instances' expectatons.

* tests: work around MethodNotImplemented

Raised from 'ListBackups' API on the CI emulator, but not locally.

* chore: drop use of pytz in systests

See #479 for rationale.

* chore: fix fossil in comment

* chore: move '_check_batch_status' to only calling module

Likewise the 'FauxCall' helper class it uses.

* chore: improve testcase name

* tests: replicate dbapi systest changes from #412 into new module
@tseaver tseaver added the automerge Merge the pull request once unit tests and other checks pass. label Aug 11, 2021
@tseaver tseaver added kokoro:force-run Add this label to force Kokoro to re-run the tests. and removed kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Aug 11, 2021
@gcf-merge-on-green
Copy link
Contributor

Merge-on-green attempted to merge your PR for 6 hours, but it was not mergeable because either one of your required status checks failed, one of your required reviews was not approved, or there is a do not merge label. Learn more about your required status checks here: https://help.github.com/en/github/administering-a-repository/enabling-required-status-checks. You can remove and reapply the label to re-run the bot.

@gcf-merge-on-green gcf-merge-on-green bot removed the automerge Merge the pull request once unit tests and other checks pass. label Aug 12, 2021
@tseaver tseaver added automerge Merge the pull request once unit tests and other checks pass. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Aug 12, 2021
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 12, 2021
@gcf-merge-on-green gcf-merge-on-green bot merged commit 9746062 into master Aug 12, 2021
@gcf-merge-on-green gcf-merge-on-green bot deleted the tests-allow-prerelease-deps-python39 branch August 12, 2021 02:42
@gcf-merge-on-green gcf-merge-on-green bot removed the automerge Merge the pull request once unit tests and other checks pass. label Aug 12, 2021
tseaver added a commit that referenced this pull request Aug 17, 2021
Consensus from today's meeting is that testing against prereleases needs
to happen outside the normal presubmit path.

Reverts only part of PR #479.
gcf-merge-on-green bot pushed a commit that referenced this pull request Aug 18, 2021
Consensus from today's meeting is that testing against prereleases needs to happen outside the normal presubmit path.

Reverts only part of PR #479.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/python-spanner API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants