summaryrefslogtreecommitdiffstats
path: root/tests/languages/rust_test.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-01-30 16:53:19 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-01-30 16:53:19 +0000
commit02d5100afa71d1343de4066b812cd4cdc774d812 (patch)
tree6bccae957398fab29aaa226fb0bd65f0c258a36a /tests/languages/rust_test.py
parentAdding upstream version 2.21.0. (diff)
downloadpre-commit-upstream/3.0.2.tar.xz
pre-commit-upstream/3.0.2.zip
Adding upstream version 3.0.2.upstream/3.0.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--tests/languages/rust_test.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/languages/rust_test.py b/tests/languages/rust_test.py
index f011e71..b8167a9 100644
--- a/tests/languages/rust_test.py
+++ b/tests/languages/rust_test.py
@@ -1,5 +1,6 @@
from __future__ import annotations
+from typing import Mapping
from unittest import mock
import pytest
@@ -48,7 +49,9 @@ def test_installs_with_bootstrapped_rustup(tmpdir, language_version):
original_find_executable = parse_shebang.find_executable
- def mocked_find_executable(exe: str) -> str | None:
+ def mocked_find_executable(
+ exe: str, *, env: Mapping[str, str] | None = None,
+ ) -> str | None:
"""
Return `None` the first time `find_executable` is called to ensure
that the bootstrapping code is executed, then just let the function
@@ -59,7 +62,7 @@ def test_installs_with_bootstrapped_rustup(tmpdir, language_version):
find_executable_exes.append(exe)
if len(find_executable_exes) == 1:
return None
- return original_find_executable(exe)
+ return original_find_executable(exe, env=env)
with mock.patch.object(parse_shebang, 'find_executable') as find_exe_mck:
find_exe_mck.side_effect = mocked_find_executable