Пример #1
0
def main():
    '''
    Entry point of autostack.
    '''

    create_pipe(PIPE_PATH)

    with open(PIPE_PATH) as pipe:
        listen_for_errors(pipe)
Пример #2
0
def capture():
    '''
    Capture all error messages outputed in the terminal for configured
    languages.
    '''

    create_pipe(PIPE_PATH)

    if sys.platform.startswith('darwin'):  # Mac
        subprocess.run(['script', '-q', '-F', '/tmp/monitorPipe'], check=True)
    else:
        subprocess.run(['script', '-q', '-f', '/tmp/monitorPipe'], check=True)
Пример #3
0
def test_create_pipe_file_doesnt_exist():
    ''''
    Ensures that create_pipe creates a pipe, if it doesn't exist.
    '''

    # 1. Given.
    path = '/tmp/pipe'

    # 2. When.
    create_pipe(path)

    # 3. Then.
    assert os.path.exists(path)

    os.remove(path)
Пример #4
0
def test_create_pipe_file_already_exists():
    ''''
    Ensures that if a file already exists at the specifies path,
    it will not be overwritten.
    '''

    # 1. Given.
    path = '/tmp/pipe'

    # 2. When.
    os.mkfifo(path)
    mtime = os.path.getmtime(path)
    create_pipe(path)

    # 3. Then.
    assert os.path.getmtime(path) == mtime
Пример #5
0
def test_create_pipe_dir_doesnt_exist():
    ''''
    Ensures that create_pipe creates the directories to the pipe
    recursively.
    '''

    # 1. Given.
    path = '/tmp/test/dir/pipe'

    # 2. When.
    create_pipe(path)

    # 3. Then.
    assert os.path.exists(path)

    shutil.rmtree('/tmp/test/')