Exemple #1
0
 def mock_local_env(env, line):
     if env:
         eq = shell_literal('=')
         env_vars = [jbos(safe_str(name), eq, safe_str(value))
                     for name, value in env.items()]
     else:
         env_vars = []
     return env_vars + wshell.escape_line(line, listify=True)
Exemple #2
0
 def test_iterable(self):
     self.assertEqual(windows.escape_line(['foo', 'bar']), ['foo', 'bar'])
     gen = (i for i in ['foo', 'bar'])
     self.assertEqual(windows.escape_line(gen), gen)
     self.assertEqual(windows.escape_line(gen, listify=True),
                      ['foo', 'bar'])
Exemple #3
0
 def test_path(self):
     self.assertEqual(windows.escape_line(Path('foo')),
                      shell_list([Path('foo')]))
Exemple #4
0
 def test_jbos(self):
     self.assertEqual(
         windows.escape_line(jbos('foo', literal('bar'))),
         shell_list([jbos(shell_literal('foo'), literal('bar'))]))
Exemple #5
0
 def test_string(self):
     self.assertEqual(windows.escape_line('foo bar'),
                      shell_list([shell_literal('foo bar')]))