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 — feat: add Prefixer class to generate and parse resource names by tswast · Pull Request #39 · googleapis/python-test-utils

This repository was archived by the owner on Feb 9, 2026. It is now read-only.

Conversation

@tswast

@tswast tswast commented Jul 2, 2021

Copy link
Copy Markdown
Contributor

This Prefixer class is intended to be created once per test file and/or test suite (such as in a conftest.py file). It can be used to generate standard resource names, which can easily identify which test suite created them. Also, since they contain the UTC date/time that the resource was created to facilitate cleanup fixtures.

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #10 🦕

Sorry, something went wrong.

Uh oh!

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

All reactions
tswast added 2 commits July 1, 2021 17:03
@tswast
WIP: add helper functions for resource prefixes
339a3a5
@tswast
add tests
6db1c42
@tswast
tswast requested a review from a team July 2, 2021 21:48
@google-cla google-cla Bot added the cla: yes This human has signed the Contributor License Agreement. label Jul 2, 2021
tseaver
tseaver suggested changes Jul 6, 2021
View reviewed changes
Comment thread test_utils/prefixer.py Resolved

Uh oh!

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

Comment thread test_utils/prefixer.py Resolved

Uh oh!

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

@tswast @tseaver
use compiled sub method
232deb8
Co-authored-by: Tres Seaver <[email protected]>
@google-cla

google-cla Bot commented Jul 7, 2021

Copy link
Copy Markdown

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

All reactions

Sorry, something went wrong.

Uh oh!

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

@google-cla google-cla Bot added cla: no This human has *not* signed the Contributor License Agreement. and removed cla: yes This human has signed the Contributor License Agreement. labels Jul 7, 2021
@tswast @tseaver
add summary docstring
e55c0e0
Co-authored-by: Tres Seaver <[email protected]>
@google-cla

google-cla Bot commented Jul 7, 2021

Copy link
Copy Markdown

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

All reactions

Sorry, something went wrong.

Uh oh!

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

@tswast tswast added cla: yes This human has signed the Contributor License Agreement. and removed cla: no This human has *not* signed the Contributor License Agreement. labels Jul 7, 2021
@tswast
tswast requested a review from tseaver July 7, 2021 14:14
@tswast
clean whitespace
d91771e
@google-cla

google-cla Bot commented Jul 7, 2021

Copy link
Copy Markdown

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

All reactions

Sorry, something went wrong.

Uh oh!

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

@google-cla google-cla Bot added cla: no This human has *not* signed the Contributor License Agreement. and removed cla: yes This human has signed the Contributor License Agreement. labels Jul 7, 2021
@tswast tswast added cla: yes This human has signed the Contributor License Agreement. and removed cla: no This human has *not* signed the Contributor License Agreement. labels Jul 7, 2021
tseaver
tseaver approved these changes Jul 7, 2021
View reviewed changes
@tseaver
tseaver merged commit 865480b into master Jul 7, 2021
@tseaver
tseaver deleted the issue10-resource-prefixes branch July 7, 2021 17:46
@tswast tswast mentioned this pull request Jul 8, 2021
test: System tests create and destroy way too many datasets googleapis/python-bigquery#716
Closed
plamut
plamut reviewed Jul 9, 2021
View reviewed changes
Comment thread tests/unit/test_prefixer.py
Comment on lines +24 to +26
"""Fake datetime class since pytest can't monkeypatch attributes of
built-in/extension type.
"""

@plamut plamut Jul 9, 2021

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would using freezegun represent a viable alternative?

True, it would be a new dependency, but it's widely used and maintained, and supports a wide range of features.

(the downside is that the more recent versions require Python 3.5+, but it could still be an option when Python 2.7 support is finally dropped in all libraries)

Sorry, something went wrong.

Uh oh!

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

All reactions

@tswast tswast Jul 15, 2021

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, freezegun would have been the more robust choice. Indeed, I didn't want to introduce a new dependency just for this.

Sorry, something went wrong.

Uh oh!

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

All reactions
@tswast tswast mentioned this pull request Jul 15, 2021
docs: add loading data from Firestore backup sample googleapis/python-bigquery#737
Merged
gcf-merge-on-green Bot pushed a commit to googleapis/python-bigquery that referenced this pull request Jul 16, 2021
@tswast
docs: add loading data from Firestore backup sample (#737)
22fd848
Follow-up to #736

To be included here: https://cloud.google.com/bigquery/docs/loading-data-cloud-firestore

Also

* Use `google-cloud-testutils` for cleanup as described in googleapis/python-test-utils#39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

2 more reviewers
@plamut plamut plamut left review comments
@tseaver tseaver tseaver 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.

methods to create and parse standard resource prefixes with repo_name, directory_path as parameters

Uh oh!

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

3 participants

@tswast @tseaver @plamut
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.