Lines Matching refs:env
43 def _evaluate_env_in_shell(env): argument
62 env.write(temp)
99 self.env = environment.Environment()
102 self.var_already_set = self.env.normalize_key('var_already_set')
107 self.var_not_set = self.env.normalize_key('var_not_set')
118 self.env.set(self.var_not_set, '1')
119 with self.env(export=False) as env:
120 self.assertIn(self.var_not_set, env)
121 self.assertEqual(env[self.var_not_set], '1')
124 self.env.set(self.var_not_set, '1')
125 env = _evaluate_env_in_shell(self.env)
126 self.assertIn(self.var_not_set, env)
127 self.assertEqual(env[self.var_not_set], '1')
130 self.env.set(self.var_already_set, '1')
131 with self.env(export=False) as env:
132 self.assertIn(self.var_already_set, env)
133 self.assertEqual(env[self.var_already_set], '1')
136 self.env.set(self.var_already_set, '1')
137 env = _evaluate_env_in_shell(self.env)
138 self.assertIn(self.var_already_set, env)
139 self.assertEqual(env[self.var_already_set], '1')
142 self.env.clear(self.var_not_set)
143 with self.env(export=False) as env:
144 self.assertNotIn(self.var_not_set, env)
147 self.env.clear(self.var_not_set)
148 env = _evaluate_env_in_shell(self.env)
149 self.assertNotIn(self.var_not_set, env)
152 self.env.clear(self.var_already_set)
153 with self.env(export=False) as env:
154 self.assertNotIn(self.var_already_set, env)
157 self.env.clear(self.var_already_set)
158 env = _evaluate_env_in_shell(self.env)
159 self.assertNotIn(self.var_already_set, env)
162 self.env.set(self.var_not_set, '/foo/bar/baz')
163 self.env.add_replacement('FOOBAR', '/foo/bar')
165 self.env.write(buf)
169 self.env.set('FOOBAR', '/foo/bar')
170 self.env.set(self.var_not_set, '/foo/bar/baz')
171 self.env.add_replacement('FOOBAR')
173 self.env.write(buf)
178 self.env.set(self.var_not_set, '1')
179 with self.env(export=False) as env:
180 self.assertIn(self.var_not_set, env)
184 self.env.set(self.var_not_set, '1')
185 with self.env(export=True) as env:
186 self.assertIn(self.var_not_set, env)
191 self.env.set(123, '123')
195 self.env.set('var', 123)
199 self.env.prepend(123, '123')
203 self.env.prepend('var', 123)
207 self.env.append(123, '123')
211 self.env.append('var', 123)
215 self.env.set('', '123')
219 self.env.set('123', '123')
223 self.env.set('foo=bar', '123')
227 self.env.set('abc.def', '123')
231 self.env.set('abc-def', '123')
235 self.env.set('var', '')
239 self.env.set('var', '123\n456')
243 self.env.append(self.var_already_set, 'pa=th')
266 self.env = environment.Environment(windows=self.windows,
270 self.var_already_set = self.env.normalize_key('VAR_ALREADY_SET')
275 self.var_not_set = self.env.normalize_key('VAR_NOT_SET')
294 self.env.prepend(self.var_already_set, 'path')
295 with self.env(export=False) as env:
296 self.assertEqual(env[self.var_already_set],
304 self.env.prepend(self.var_already_set, 'path')
305 env = _evaluate_env_in_shell(self.env)
306 self.assertEqual(env[self.var_already_set],
310 self.env.prepend(self.var_not_set, 'path')
311 with self.env(export=False) as env:
312 self.assertEqual(env[self.var_not_set], 'path')
318 self.env.prepend(self.var_not_set, 'path')
319 env = _evaluate_env_in_shell(self.env)
320 self.assertEqual(env[self.var_not_set], 'path')
324 self.env.append(self.var_already_set, 'path')
325 with self.env(export=False) as env:
326 self.assertEqual(env[self.var_already_set],
334 self.env.append(self.var_already_set, 'path')
335 env = _evaluate_env_in_shell(self.env)
336 self.assertEqual(env[self.var_already_set],
340 self.env.append(self.var_not_set, 'path')
341 with self.env(export=False) as env:
342 self.assertEqual(env[self.var_not_set], 'path')
348 self.env.append(self.var_not_set, 'path')
349 env = _evaluate_env_in_shell(self.env)
350 self.assertEqual(env[self.var_not_set], 'path')
353 self.env.set(self.var_not_set,
356 self.env.append(self.var_not_set, 'path')
357 with self.env(export=False) as env:
358 self.assertEqual(env[self.var_not_set],
368 self.env.set(self.var_not_set,
371 self.env.append(self.var_not_set, 'path')
372 env = _evaluate_env_in_shell(self.env)
373 self.assertEqual(env[self.var_not_set],
377 self.env.set(self.var_not_set,
380 self.env.append(self.var_not_set, 'pa th')
381 with self.env(export=False) as env:
382 self.assertEqual(env[self.var_not_set],
392 self.env.set(self.var_not_set,
395 self.env.append(self.var_not_set, 'pa th')
396 env = _evaluate_env_in_shell(self.env)
397 self.assertEqual(env[self.var_not_set],
401 self.env.remove(self.var_not_set, 'path')
402 with self.env(export=False) as env:
403 self.assertNotIn(self.var_not_set, env)
409 self.env.remove(self.var_not_set, 'path')
410 env = _evaluate_env_in_shell(self.env)
411 self.assertNotIn(self.var_not_set, env)
448 env = environment.Environment()
449 env.append(lower_var, 'foo')
450 env.append(upper_var, 'bar')
451 with env(export=False) as env_: