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`', )
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`', )
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.', )
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`.', )
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.', )