예제 #1
0
def test_r_parsing_file_opts_no_args(tempdir_factory, store):
    with pytest.raises(ValueError) as excinfo:
        r._entry_validate(['Rscript', '--no-init', '/path/to/file'])

    msg = excinfo.value.args
    assert msg == (
        'The only valid syntax is `Rscript -e {expr}`',
        'or `Rscript path/to/hook/script`',
    )
예제 #2
0
파일: r_test.py 프로젝트: mtdev2/pre-commit
def test_r_parsing_expr_opts_no_args2(tempdir_factory, store):
    with pytest.raises(ValueError) as execinfo:
        r._entry_validate(
            [
                'Rscript', '--vanilla', '-e', '1+1', '-e', 'letters',
            ],
        )
    msg = execinfo.value.args
    assert msg == (
        'The only valid syntax is `Rscript -e {expr}`',
        'or `Rscript path/to/hook/script`',
    )
예제 #3
0
def test_r_parsing_expr_no_opts_no_args2(tempdir_factory, store):
    with pytest.raises(ValueError) as execinfo:
        r._entry_validate(['Rscript', '-e', '1+1', '-e', 'letters'])
    msg = execinfo.value.args
    assert msg == ('You can supply at most one expression.', )
예제 #4
0
def test_r_parsing_expr_non_Rscirpt(tempdir_factory, store):
    with pytest.raises(ValueError) as execinfo:
        r._entry_validate(['AnotherScript', '-e', '{{}}'])

    msg = execinfo.value.args
    assert msg == ('entry must start with `Rscript`.', )
예제 #5
0
def test_r_parsing_expr_args_in_entry2(tempdir_factory, store):
    with pytest.raises(ValueError) as execinfo:
        r._entry_validate(['Rscript', '-e', 'expr1', '--another-arg'])

    msg = execinfo.value.args
    assert msg == ('You can supply at most one expression.', )