diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-04-04 18:42:11 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-04-04 18:42:11 +0000 |
commit | 361ff4da262b4891323287049e9e6c5fbe1d01dc (patch) | |
tree | 969b376a2c170841758d39ef9516dac65c8b94cd /tests/languages/r_test.py | |
parent | Adding upstream version 2.17.0. (diff) | |
download | pre-commit-upstream/2.18.1.tar.xz pre-commit-upstream/2.18.1.zip |
Adding upstream version 2.18.1.upstream/2.18.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | tests/languages/r_test.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/languages/r_test.py b/tests/languages/r_test.py index 66aa7b3..5bc63b2 100644 --- a/tests/languages/r_test.py +++ b/tests/languages/r_test.py @@ -1,7 +1,10 @@ +from __future__ import annotations + 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 @@ -127,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' |