|
25 | 25 | from testing.fixtures import make_config_from_repo |
26 | 26 | from testing.fixtures import make_repo |
27 | 27 | from testing.fixtures import modify_manifest |
| 28 | +from testing.language_helpers import run_language |
28 | 29 | from testing.util import cwd |
29 | 30 | from testing.util import get_resource_path |
30 | 31 |
|
31 | 32 |
|
32 | | -def _norm_out(b): |
33 | | - return b.replace(b'\r\n', b'\n') |
34 | | - |
35 | | - |
36 | 33 | def _hook_run(hook, filenames, color): |
37 | | - with languages[hook.language].in_env(hook.prefix, hook.language_version): |
38 | | - return languages[hook.language].run_hook( |
39 | | - hook.prefix, |
40 | | - hook.entry, |
41 | | - hook.args, |
42 | | - filenames, |
43 | | - is_local=hook.src == 'local', |
44 | | - require_serial=hook.require_serial, |
45 | | - color=color, |
46 | | - ) |
| 34 | + return run_language( |
| 35 | + path=hook.prefix.prefix_dir, |
| 36 | + language=languages[hook.language], |
| 37 | + exe=hook.entry, |
| 38 | + args=hook.args, |
| 39 | + file_args=filenames, |
| 40 | + version=hook.language_version, |
| 41 | + deps=hook.additional_dependencies, |
| 42 | + is_local=hook.src == 'local', |
| 43 | + require_serial=hook.require_serial, |
| 44 | + color=color, |
| 45 | + ) |
47 | 46 |
|
48 | 47 |
|
49 | 48 | def _get_hook_no_install(repo_config, store, hook_id): |
@@ -77,7 +76,7 @@ def _test_hook_repo( |
77 | 76 | hook = _get_hook(config, store, hook_id) |
78 | 77 | ret, out = _hook_run(hook, args, color=color) |
79 | 78 | assert ret == expected_return_code |
80 | | - assert _norm_out(out) == expected |
| 79 | + assert out == expected |
81 | 80 |
|
82 | 81 |
|
83 | 82 | def test_python_hook(tempdir_factory, store): |
@@ -425,7 +424,7 @@ def test_local_python_repo(store, local_python_config): |
425 | 424 | assert hook.language_version != C.DEFAULT |
426 | 425 | ret, out = _hook_run(hook, ('filename',), color=False) |
427 | 426 | assert ret == 0 |
428 | | - assert _norm_out(out) == b"['filename']\nHello World\n" |
| 427 | + assert out == b"['filename']\nHello World\n" |
429 | 428 |
|
430 | 429 |
|
431 | 430 | def test_default_language_version(store, local_python_config): |
|
0 commit comments