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

refactor(test): add util.chdir, util.copied_fixtures_dir contextmanagers to clean up tests #1053

Merged
merged 9 commits into from
Apr 20, 2021

Conversation

chingor13
Copy link
Contributor

@chingor13 chingor13 commented Apr 16, 2021

  • util.chdir(path) - changes the current working directory and restores the original
  • util.copied_fixtures_dir(path) - copies an entire directory to a new temporary directory, chdirs into that directory, and restores the original current working directory

These are 2 very common test setups that are used across the tests in this repository. It will help us ensure that we are correctly restoring the cwd between tests.

refactor(test): use chdir contextmanager to clean up some tests

refactor(test): use chdir contextmanager to clean up some tests

refactor(test): use chdir contextmanager to clean up some tests
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Apr 16, 2021
@chingor13 chingor13 changed the title refactor(test): add util.chdir contextmanager to clean up tests refactor(test): add util.chdir, util.copied_fixtures_dir contextmanagers to clean up tests Apr 16, 2021
Copy link
Contributor

@bcoe bcoe left a comment

Choose a reason for hiding this comment

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

Love this new helper.

@chingor13 chingor13 merged commit 5a6f30b into googleapis:master Apr 20, 2021
@chingor13 chingor13 deleted the cwd-context-manager branch April 20, 2021 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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