def test_integration(tmpdir, capsys, contents, expected, expected_out):
    tmpfilename = tmpdir.join('test.py').strpath
    with io.open(tmpfilename, 'w') as tmpfile:
        tmpfile.write(contents)

    assert main([tmpfilename]) == expected
    assert capsys.readouterr()[0] == expected_out.format(filename=tmpfilename)
def test_integration(tmpdir, capsys, contents, expected, expected_out):
    tmpfilename = tmpdir.join('test.py').strpath
    with io.open(tmpfilename, 'w') as tmpfile:
        tmpfile.write(contents)

    assert main([tmpfilename]) == expected
    assert capsys.readouterr()[0] == expected_out.format(filename=tmpfilename)
def test_arbitrary_encoding(tmpdir):
    f = tmpdir.join('f.py')
    contents = '# -*- coding: cp1252\nx = "£"'.encode('cp1252')
    f.write_binary(contents)
    assert main([f.strpath]) == 0
def test_integration(tmpdir, capsys, contents, expected, expected_out):
    f = tmpdir.join('test.py')
    f.write_binary(contents)
    assert main([f.strpath]) == expected
    assert capsys.readouterr()[0] == expected_out.format(filename=f.strpath)
Exemple #5
0
def test_arbitrary_encoding(tmpdir):
    f = tmpdir.join('f.py')
    contents = '# -*- coding: cp1252\nx = "£"'.encode('cp1252')
    f.write_binary(contents)
    assert main([str(f)]) == 0
Exemple #6
0
def test_integration(tmpdir, capsys, contents, expected, expected_out):
    f = tmpdir.join('test.py')
    f.write_binary(contents)
    assert main([str(f)]) == expected
    assert capsys.readouterr()[0] == expected_out.format(filename=str(f))