Exemplo n.º 1
0
def test_two_directories(capsys):
    main([
        __file__.replace('test_main.py', ''),
        __file__.replace('test_main.py', '')
    ])
    cap = capsys.readouterr()
    assert cap.out.count('test_files/01 ok.mp3') == 2
Exemplo n.º 2
0
def test_relative_path(capsys):
    """This test assumes you're running it with ``pytest`` from root directory"""
    main(['tests/test_files'])
    output, error = capsys.readouterr()
    assert 'file://' not in output, output
    assert 'tests/test_files/01 ok.mp3' in output, output
    assert 'tests/test_files/02 ok.flac' in output, output
    assert 'no.png' not in output, output
    assert 'no.png' not in error, error
Exemplo n.º 3
0
def test_absolute_path_trailing_slash(capsys):
    main([__file__.replace('test_main.py', 'test_files/')])
    output, error = capsys.readouterr()
    assert 'file:///' in output, output
    assert 'test_files/01 ok.mp3' in output, output
    assert 'test_files/02 ok.flac' in output, output
    assert '/test_files/02 ok.flac' in output, output
    assert 'no.png' not in output, output
    assert 'no.png' not in error, error
Exemplo n.º 4
0
def test_show_discarded(capsys):
    """Current working directory should be used here"""
    main(['-d'])
    cap = capsys.readouterr()
    assert 'file:///' in cap.out, cap.out
    assert 'test_files/01 ok.mp3' in cap.out, cap.out
    assert 'test_files/02 ok.flac' in cap.out, cap.out
    assert '/test_files/02 ok.flac' in cap.out, cap.out
    assert 'no.png' not in cap.out, cap.out
    assert 'no.png' in cap.err, cap.err
Exemplo n.º 5
0
def test_not_existing_directory(capsys):
    main(['not_here'])
    _, error = capsys.readouterr()
    assert error == 'not_here is not a directory\n'