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)
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'])
def test_path(self): self.assertEqual(windows.escape_line(Path('foo')), shell_list([Path('foo')]))
def test_jbos(self): self.assertEqual( windows.escape_line(jbos('foo', literal('bar'))), shell_list([jbos(shell_literal('foo'), literal('bar'))]))
def test_string(self): self.assertEqual(windows.escape_line('foo bar'), shell_list([shell_literal('foo bar')]))