I hereby claim:
- I am drorata on github.
- I am drorata (https://keybase.io/drorata) on keybase.
- I have a public key ASAZL79Xn8nWNG3itxSCpryTA_ClCeZuZlxRei2CYvJpHQo
To claim this, I am signing this object:
| """ | |
| Following on the answer: https://stackoverflow.com/a/46451650/671013 | |
| Fix of version https://gist.github.com/drorata/1fa68b477d94aea5d37e87aa56e09295/6678ad2056edc60ee77a4e986c626f5dcb662a2a | |
| """ | |
| import click | |
| class OptionRequiredIf(click.Option): |
| for i in `conda env list | grep test | cut -d" " -f1`; | |
| do | |
| conda env remove -n $i | |
| done |
I hereby claim:
To claim this, I am signing this object:
| import click | |
| @click.group() | |
| def app(): | |
| pass | |
| @app.command() | |
| @click.option('-x') |
| def test_example(monkeypatch): | |
| # Print the value of $FOO. If not defined will be None | |
| print("FOO = %s" % os.getenv('FOO')) | |
| monkeypatch.setenv('FOO', '3.14') | |
| print("FOO = %s" % os.getenv('FOO')) # Expected result: FOO = 3.14 | |
| with monkeypatch.context() as m: | |
| m.setenv('FOO', '2.71') | |
| print("FOO = %s" % os.getenv('FOO')) # Expected result: FOO = 2.71 | |
| print("FOO = %s" % os.getenv('FOO')) # Expected result: FOO = 3.14 |