summaryrefslogtreecommitdiffstats
path: root/tests/languages/r_test.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-04-04 18:42:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-04-04 18:42:30 +0000
commit9d68e4e3da4ce68e28506d926c7de9fd6ffbf6a3 (patch)
treea6d016823a24941dd795d30ba84409db12aa41cb /tests/languages/r_test.py
parentReleasing debian version 2.17.0-1. (diff)
downloadpre-commit-9d68e4e3da4ce68e28506d926c7de9fd6ffbf6a3.tar.xz
pre-commit-9d68e4e3da4ce68e28506d926c7de9fd6ffbf6a3.zip
Merging upstream version 2.18.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/languages/r_test.py')
-rw-r--r--tests/languages/r_test.py14
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'