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

use "with environment_variable(...)" #1002

Closed
ThomasWaldmann opened this issue May 1, 2016 · 2 comments
Closed

use "with environment_variable(...)" #1002

ThomasWaldmann opened this issue May 1, 2016 · 2 comments
Assignees
Milestone

Comments

@ThomasWaldmann
Copy link
Member

there are some places in the tests that could use this.

it is a context manager that remembers state of environment vars, sets the env vars as given in kwargs, executes the block, and finally restores the previous state of the environment vars.

@enkore
Copy link
Contributor

enkore commented May 1, 2016

pytest monkeypatch can do this as well - but not for unittest.TestCase test methods... so at some point (when client tests are py.test-style) that can be removed. In the meantime it's best to use env_var for unittest-based stuff and monkeypatch where py.test is already used.

@ThomasWaldmann ThomasWaldmann modified the milestones: 2.0.0b6, 2.x Apr 7, 2023
@ThomasWaldmann ThomasWaldmann self-assigned this Jul 24, 2023
@ThomasWaldmann ThomasWaldmann modified the milestones: 2.x, 2.0.0b7 Jul 24, 2023
@ThomasWaldmann
Copy link
Member Author

ThomasWaldmann commented Jul 24, 2023

todo b7:

  • replace environment_variable with monkeypatch.setenv (it is all pytest now).
  • remove environment_variable if no users left

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants