Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a5fe6c5

Browse filesBrowse files
authored
Merge pull request #3496 from ericphanson/eph/jl-startup
Julia language: skip startup.jl file
2 parents c681721 + 6f1f433 commit a5fe6c5
Copy full SHA for a5fe6c5

File tree

Expand file treeCollapse file tree

2 files changed

+17
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+17
-2
lines changed
Open diff view settings
Collapse file

‎pre_commit/languages/julia.py‎

Copy file name to clipboardExpand all lines: pre_commit/languages/julia.py
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def run_hook(
3737

3838
cmd = lang_base.hook_cmd(entry, args)
3939
script = cmd[0] if is_local else prefix.path(cmd[0])
40-
cmd = ('julia', script, *cmd[1:])
40+
cmd = ('julia', '--startup-file=no', script, *cmd[1:])
4141
return lang_base.run_xargs(
4242
cmd,
4343
file_args,
@@ -127,6 +127,7 @@ def install_environment(
127127
end
128128
"""
129129
cmd_output_b(
130-
'julia', '-e', julia_code, '--', envdir, *additional_dependencies,
130+
'julia', '--startup-file=no', '-e', julia_code, '--', envdir,
131+
*additional_dependencies,
131132
cwd=prefix.prefix_dir,
132133
)
Collapse file

‎tests/languages/julia_test.py‎

Copy file name to clipboardExpand all lines: tests/languages/julia_test.py
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
from __future__ import annotations
22

3+
import os
4+
from unittest import mock
5+
36
from pre_commit.languages import julia
47
from testing.language_helpers import run_language
58
from testing.util import cwd
@@ -28,6 +31,17 @@ def test_julia_hook(tmp_path):
2831
assert run_language(tmp_path, julia, 'src/main.jl') == expected
2932

3033

34+
def test_julia_hook_with_startup(tmp_path):
35+
depot_path = tmp_path.joinpath('depot')
36+
depot_path.joinpath('config').mkdir(parents=True)
37+
startup = depot_path.joinpath('config', 'startup.jl')
38+
startup.write_text('error("Startup file used!")\n')
39+
40+
depo_path_var = f'{depot_path}{os.pathsep}'
41+
with mock.patch.dict(os.environ, {'JULIA_DEPOT_PATH': depo_path_var}):
42+
test_julia_hook(tmp_path)
43+
44+
3145
def test_julia_hook_manifest(tmp_path):
3246
code = """
3347
using Example

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.