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 — Convert tasks example to use logging for testability by andrewsg · Pull Request #1219 · GoogleCloudPlatform/python-docs-samples

Conversation

@andrewsg

@andrewsg andrewsg commented Nov 14, 2017

Copy link
Copy Markdown
Member

No description provided.

Sorry, something went wrong.

Uh oh!

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

All reactions
@andrewsg
Convert tasks example to use logging for testability
5c37f07
@andrewsg
andrewsg requested a review from theacodes November 14, 2017 23:08
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Nov 14, 2017
@andrewsg andrewsg mentioned this pull request Nov 14, 2017
Auto-update dependencies. #1217
Merged
@theacodes

theacodes commented Nov 15, 2017

Copy link
Copy Markdown
Contributor

We generally don't use logging in our samples, what about this makes the sample more testable?

All reactions

Sorry, something went wrong.

Uh oh!

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

@andrewsg

andrewsg commented Nov 15, 2017

Copy link
Copy Markdown
Member Author

Previously we had print() which turned out to be hard to reliably mock in a way that works across Py2 and 3. Logging is easy to mock. Either way, the output goes to the same place; we need some sort of off-instance data storage to prove the task ran, and the logging console is the most convenient place without pulling in another dependency.

All reactions

Sorry, something went wrong.

Uh oh!

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

theacodes
theacodes approved these changes Nov 15, 2017
View reviewed changes
@andrewsg
Use capsys to test tasks
d559a24
@andrewsg
andrewsg force-pushed the tasks branch from 8805674 to d559a24 Compare November 15, 2017 18:45
@andrewsg
andrewsg merged commit 19788b0 into GoogleCloudPlatform:master Nov 15, 2017
arithmetic1728 pushed a commit to googleapis/python-tasks that referenced this pull request Sep 2, 2020
@andrewsg
Convert tasks example to use logging for testability [(#1219)](Google…
ab6e52a
…CloudPlatform/python-docs-samples#1219)

* Convert tasks example to use logging for testability

* Use capsys to test tasks
@parthea parthea mentioned this pull request Sep 8, 2026
migrate code from googleapis/python-bigquery #14589
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@theacodes theacodes theacodes approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

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

Assignees

No one assigned

Labels

cla: yes This human has signed the Contributor License Agreement.

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.

3 participants

@andrewsg @theacodes @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.