Exemplo n.º 1
0
    def __call__(self):
        # type: () -> None
        command = self._command
        schema = self._schema

        process = Popen(command, stdin=PIPE, stdout=PIPE, stderr=STDOUT)
        # Simulate manually typing the schema in.
        # Didn't find any other way to pass the schema (eg --query="file /path/to/schema.sql" won't work).
        process.communicate(ensure_bytes(schema))
        process.wait()

        if process.returncode != 0:
            raise SubprocessError('Command: {}\nExit code: {}'.format(
                command, process.returncode))
Exemplo n.º 2
0
 def test_ensure_bytes(self):
     assert ensure_bytes('qwerty') == b'qwerty'
Exemplo n.º 3
0
 def test_ensure_bytes_py2(self):
     assert ensure_bytes('éâû') == 'éâû'
     assert ensure_bytes(u'éâû') == 'éâû'