Exemplo n.º 1
0
def test_format_multiple():
    import pytest
    from pydevf import start_format_server
    from pydevf import format_code_server
    from pydevf import stop_format_server

    process = start_format_server()

    for _ in range(3):
        new_contents = format_code_server(process, code1)
        assert (repr(new_contents)) == repr(code1_expected)

        with pytest.raises(RuntimeError):
            format_code_server(process, code_error)

    stop_format_server(process)
Exemplo n.º 2
0
    def format_code(code_to_format):
        if not formatter:
            _wait_current_processes()

            # Start-up pydevf server on demand.
            process = pydevf.start_format_server()
            formatter.append(process)
            _created_processes.append(process)
        return pydevf.format_code_server(formatter[0], code_to_format)
Exemplo n.º 3
0
    def format_code(code_to_format):
        if not formatter:
            _wait_current_processes()

            # Start-up pydevf server on demand.
            process = pydevf.start_format_server()
            formatter.append(process)
            _created_processes.append(process)
        return pydevf.format_code_server(formatter[0], code_to_format)
Exemplo n.º 4
0
 def format_code(code_to_format):
     if not formatter:
         # Start-up pydevf server on demand.
         formatter.append(pydevf.start_format_server())
     return pydevf.format_code_server(formatter[0], code_to_format)