def test_main_failing(tmpdir, input_src, expected_ret, output_src):
    filename = tmpdir.join('test.py').strpath
    with io.open(filename, 'w') as file_obj:
        file_obj.write(input_src)
    ret = main([filename, '-i', '-v'])
    assert ret == expected_ret
    assert io.open(filename).read() == output_src
def test_main_failing(tmpdir, input_src, expected_ret, output_src):
    filename = os.path.join(tmpdir.strpath, 'test.py')
    with io.open(filename, 'w') as file_obj:
        file_obj.write(input_src)
    ret = main([filename, '-i', '-v'])
    assert ret == expected_ret
    assert io.open(filename).read() == output_src
def test_respects_config_file():
    with io.open('setup.cfg', 'w') as setup_cfg:
        setup_cfg.write('[pep8]\nignore=E221')

    with io.open('test.py', 'w') as test_py:
        test_py.write('print(1    + 2)\n')

    assert main(['test.py', '-i', '-v']) == 0
def test_respects_config_file():
    with io.open('setup.cfg', 'w') as setup_cfg:
        setup_cfg.write('[pep8]\nignore=E221')

    with io.open('test.py', 'w') as test_py:
        test_py.write('print(1    + 2)\n')

    assert main(['test.py', '-i', '-v']) == 0
def test_respects_config_file(tmpdir):
    with tmpdir.as_cwd():
        tmpdir.join('setup.cfg').write('[pycodestyle]\nignore=E221')
        tmpdir.join('test.py').write('print(1    + 2)\n')
        assert main(['test.py', '-i', '-v']) == 0
def test_main_failing(tmpdir, input_src, expected_ret, output_src):
    path = tmpdir.join('test.py')
    path.write(input_src)
    ret = main([path.strpath, '-i', '-v'])
    assert ret == expected_ret
    assert path.read() == output_src
예제 #7
0
def test_invariantly_fails():
    with pytest.raises(SystemExit) as excinfo:
        main()
    msg, = excinfo.value.args
    assert 'https://github.com/pre-commit/mirrors-autopep8' in msg