def test_new_log_file():
    # Just a shorthand for persistent print.

    log_file_loc = new_log_file('dump/test_file')
    print 'eee'
    print 'fff'
    stop_capturing_print()

    local_log_loc = get_local_path(log_file_loc)
    with open(local_log_loc) as f:
        text = f.read()

    assert text == 'eee\nfff\n'
    os.remove(local_log_loc)
def test_new_log_file():
    # Just a shorthand for persistent print.

    log_file_loc = new_log_file('dump/test_file')
    print('eee')
    print('fff')
    stop_capturing_print()

    local_log_loc = get_artemis_data_path(log_file_loc)
    with open(local_log_loc) as f:
        text = f.read()

    assert text == 'eee\nfff\n'
    os.remove(local_log_loc)
def test_persistent_print():

    test_log_path = capture_print()
    print 'aaa'
    print 'bbb'
    assert read_print()  == 'aaa\nbbb\n'
    stop_capturing_print()

    capture_print()
    assert read_print() == ''
    print 'ccc'
    print 'ddd'
    assert read_print()  == 'ccc\nddd\n'

    os.remove(get_local_path(test_log_path))
def test_persistent_print():

    test_log_path = capture_print()
    print('aaa')
    print('bbb')
    assert read_print() == 'aaa\nbbb\n'
    stop_capturing_print()

    capture_print()
    assert read_print() == ''
    print('ccc')
    print('ddd')
    assert read_print() == 'ccc\nddd\n'

    os.remove(get_artemis_data_path(test_log_path))
def test_persistent_print():

    test_log_path = capture_print()
    print('aaa')
    print('bbb')
    assert read_print()  == 'aaa\nbbb\n'
    stop_capturing_print()

    capture_print()
    assert read_print() == ''
    print('ccc')
    print('ddd')
    assert read_print()  == 'ccc\nddd\n'

    os.remove(get_artemis_data_path(test_log_path))