Example #1
0
def test_identify_cli(capsys):
    ret = cli.main(('setup.py', ))
    out, _ = capsys.readouterr()
    assert ret == 0
    assert out == '["file", "non-executable", "python", "text"]\n'
Example #2
0
def test_identify_cli_filename_only_unidentified(capsys):
    ret = cli.main(('x.unknown', '--filename-only'))
    out, _ = capsys.readouterr()
    assert ret == 1
    assert out == ''
Example #3
0
def test_file_not_found(capsys):
    ret = cli.main(('x.unknown', ))
    out, _ = capsys.readouterr()
    assert ret == 1
    assert out == 'x.unknown does not exist.\n'
Example #4
0
def test_identify_cli_filename_only(capsys):
    ret = cli.main(('setup.py', '--filename-only'))
    out, _ = capsys.readouterr()
    assert ret == 0
    assert out == '["python", "text"]\n'