summaryrefslogtreecommitdiffstats
path: root/tests/repository_test.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-03-08 17:48:47 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-03-08 17:48:47 +0000
commit4db15c5b771323f1acdeb06e4acc671856da5ea9 (patch)
tree1cde2767753275f2f87a34a2606b2415a467ff09 /tests/repository_test.py
parentAdding upstream version 2.10.1. (diff)
downloadpre-commit-4db15c5b771323f1acdeb06e4acc671856da5ea9.tar.xz
pre-commit-4db15c5b771323f1acdeb06e4acc671856da5ea9.zip
Adding upstream version 2.11.0.upstream/2.11.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/repository_test.py')
-rw-r--r--tests/repository_test.py50
1 files changed, 49 insertions, 1 deletions
diff --git a/tests/repository_test.py b/tests/repository_test.py
index 1b58164..b6f7fb2 100644
--- a/tests/repository_test.py
+++ b/tests/repository_test.py
@@ -279,6 +279,54 @@ def test_node_hook_with_npm_userconfig_set(tempdir_factory, store, tmpdir):
test_run_a_node_hook(tempdir_factory, store)
+def test_r_hook(tempdir_factory, store):
+ _test_hook_repo(
+ tempdir_factory, store, 'r_hooks_repo',
+ 'hello-world', [os.devnull],
+ b'Hello, World, from R!\n',
+ )
+
+
+def test_r_inline_hook(tempdir_factory, store):
+ _test_hook_repo(
+ tempdir_factory, store, 'r_hooks_repo',
+ 'hello-world-inline', ['some-file'],
+ b'Hi-there, some-file, from R!\n',
+ )
+
+
+def test_r_with_additional_dependencies_hook(tempdir_factory, store):
+ _test_hook_repo(
+ tempdir_factory, store, 'r_hooks_repo',
+ 'additional-deps', [os.devnull],
+ b'OK\n',
+ config_kwargs={
+ 'hooks': [{
+ 'id': 'additional-deps',
+ 'additional_dependencies': ['cachem@1.0.4'],
+ }],
+ },
+ )
+
+
+def test_r_local_with_additional_dependencies_hook(store):
+ config = {
+ 'repo': 'local',
+ 'hooks': [{
+ 'id': 'local-r',
+ 'name': 'local-r',
+ 'entry': 'Rscript -e',
+ 'language': 'r',
+ 'args': ['if (packageVersion("R6") == "2.1.3") cat("OK\n")'],
+ 'additional_dependencies': ['R6@2.1.3'],
+ }],
+ }
+ hook = _get_hook(config, store, 'local-r')
+ ret, out = _hook_run(hook, (), color=False)
+ assert ret == 0
+ assert _norm_out(out) == b'OK\n'
+
+
def test_run_a_ruby_hook(tempdir_factory, store):
_test_hook_repo(
tempdir_factory, store, 'ruby_hooks_repo',
@@ -953,7 +1001,7 @@ def test_manifest_hooks(tempdir_factory, store):
require_serial=False,
stages=(
'commit', 'merge-commit', 'prepare-commit-msg', 'commit-msg',
- 'post-commit', 'manual', 'post-checkout', 'push',
+ 'post-commit', 'manual', 'post-checkout', 'push', 'post-merge',
),
types=['file'],
types_or=[],