GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Allow unit tests to pass if pytz is installed. by rimey · Pull Request #1706 · googleapis/google-cloud-python

Conversation

@rimey

@rimey rimey commented Apr 8, 2016

Copy link
Copy Markdown
Contributor

I'm assuming the intent of test_module_property() is
to check that gcloud._helpers.UTC is defined and has
the right sort of value. It was failing if pytz
happened to be installed.

Note that the current test environment does not
install pytz. The gcloud package uses pytz if it is
available but does not depend on it.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rimey rimey added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. api: core labels Apr 8, 2016
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Apr 8, 2016
@tseaver tseaver self-assigned this Apr 8, 2016
@tseaver

tseaver commented Apr 8, 2016

Copy link
Copy Markdown
Contributor

Thanks for the patch! ISTM that a better fix for the test would be to have it try to import pytz and DTRT depending on success. E.g.:

    def test_module_property(self):
        from gcloud import _helpers as MUT
        klass = self._getTargetClass()
        try:
            import pytz
        except ImportError:
            self.assertTrue(isinstance(MUT.UTC, klass))
        else:
            self.assertTrue(MUT.UTC is pytz.UTC)
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rimey
Allow unit tests to pass if pytz is installed.
967e939
I'm assuming the intent of test_module_property() is
to check that gcloud._helpers.UTC is defined and has
the right sort of value. It was failing if pytz
happened to be installed.

Note that the current test environment does _not_
install pytz. The gcloud package uses pytz if it is
available but does not depend on it.

As per a suggestion from @tseaver, we test gcloud._helpers.UTC
against pytz.UTC if pytz is available.
@rimey

rimey commented Apr 8, 2016

Copy link
Copy Markdown
Contributor Author

Done. PTAL.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tseaver
tseaver merged commit 3cf7d03 into googleapis:master Apr 8, 2016
@tseaver

tseaver commented Apr 8, 2016

Copy link
Copy Markdown
Contributor

Thanks very much!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dhermes

dhermes commented Apr 8, 2016

Copy link
Copy Markdown
Contributor

Why do we no cover both branches?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rimey

rimey commented Apr 8, 2016

Copy link
Copy Markdown
Contributor Author

Only one is executed in any given test environment. Did I understand your
question correctly?

On Fri, Apr 8, 2016 at 11:48 AM, Danny Hermes [email protected]
wrote:

Why do we no cover both branches?

—
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#1706 (comment)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dhermes

dhermes commented Apr 8, 2016

Copy link
Copy Markdown
Contributor

But the relevant coverage environment, i.e. the one that get's reported on our repo (from coveralls.io) use the tox cover environment. We should have that branch without a no cover pragma.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rimey

rimey commented Apr 8, 2016

Copy link
Copy Markdown
Contributor Author

I guess the idea is that the test code will do the right thing in any
reasonable environment, while the coverage pragmas on that test code will
be correct for the tox cover environment? I can send another pull request.

On Fri, Apr 8, 2016 at 11:55 AM, Danny Hermes [email protected]
wrote:

But the relevant coverage environment, i.e. the one that get's reported on
our repo (from coveralls.io) use the tox cover environment. We should
have that branch without a no cover pragma.

—
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#1706 (comment)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dhermes

dhermes commented Apr 8, 2016

Copy link
Copy Markdown
Contributor

Thanks for sending the PR!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@daspecster daspecster mentioned this pull request Apr 15, 2016
Upgrading version to 0.12.1 #1725
Merged
@rimey rimey mentioned this pull request Apr 22, 2016
Review the datetime helpers in gcloud._helpers. #1732
Closed
@rimey
rimey deleted the utc_tests branch April 23, 2016 11:36
parthea added a commit that referenced this pull request Nov 24, 2025
@parthea @dizcology
fix: rename rst files to avoid conflict with service names (#1706)
1b2f7ca
Co-authored-by: Yu-Han Liu <[email protected]>
parthea pushed a commit that referenced this pull request Nov 24, 2025
@release-please
chore(main): release 1.11.9 (#1811)
4227ff5
🤖 I have created a release *beep* *boop*
---


## [1.11.9](https://togithub.com/googleapis/gapic-generator-python/compare/v1.11.8...v1.11.9) (2023-10-18)


### Bug Fixes

* Rename rst files to avoid conflict with service names ([#1706](https://togithub.com/googleapis/gapic-generator-python/issues/1706)) ([70c3db5](https://togithub.com/googleapis/gapic-generator-python/commit/70c3db5ae1bac69e8ade13e4608af60c824e7870))

---
This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
parthea pushed a commit that referenced this pull request Apr 1, 2026
@sycai
chore: improve get_started notebook (#1706)
21b1cc8
* chore: improve get_started notebook

* some more polishing

* add dots
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@tseaver tseaver

Labels

api: core cla: yes This human has signed the Contributor License Agreement. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@rimey @tseaver @dhermes @googlebot
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.