def test_set_env_2(): import os os.environ['test_env'] = 'foo' with set_env(test_env='bar'): assert os.getenv('test_env') == 'bar', 'should got "bar"' assert os.getenv('foo') is None, 'foo'
def test_set_env_1(): import os with set_env(test_env='test'): assert os.getenv('test_env') == 'test', 'should got "test"' assert os.getenv('test_env') is None, 'no test_env'