mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
use Rscript path relative to $R_HOME/bin/...
Co-authored-by: Lorenz Walthert <lorenz.walthert@icloud.com>
This commit is contained in:
parent
934afb85a4
commit
764a0db68e
2 changed files with 17 additions and 1 deletions
|
|
@ -4,6 +4,7 @@ import os.path
|
|||
|
||||
import pytest
|
||||
|
||||
from pre_commit import envcontext
|
||||
from pre_commit.languages import r
|
||||
from testing.fixtures import make_config_from_repo
|
||||
from testing.fixtures import make_repo
|
||||
|
|
@ -129,3 +130,14 @@ def test_r_parsing_file_local(tempdir_factory, store):
|
|||
config=config,
|
||||
expect_path_prefix=False,
|
||||
)
|
||||
|
||||
|
||||
def test_rscript_exec_relative_to_r_home():
|
||||
expected = os.path.join('r_home_dir', 'bin', 'Rscript')
|
||||
with envcontext.envcontext((('R_HOME', 'r_home_dir'),)):
|
||||
assert r._rscript_exec() == expected
|
||||
|
||||
|
||||
def test_path_rscript_exec_no_r_home_set():
|
||||
with envcontext.envcontext((('R_HOME', envcontext.UNSET),)):
|
||||
assert r._rscript_exec() == 'Rscript'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue