← 返回首页
improve julia language support by ericphanson · Pull Request #3494 · pre-commit/pre-commit · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

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

Provide feedback

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

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected Viewed files
Conversations
Failed to load comments. Retry
Loading
Jump to
Jump to file
Failed to load files. Retry
Loading
Diff view
Unified
Split
Hide whitespace
Apply and reload
Show whitespace
Diff view
Unified
Split
Hide whitespace
Apply and reload
Prev Previous commit
Next Next commit
add
  • Loading branch information
ericphanson committed Jul 21, 2025
commit 5501721fa9ecc66ab1cd7b62c89270d265d8c485
38 changes: 38 additions & 0 deletions tests/languages/julia_test.py
Show comments View file Edit file Delete file Open in desktop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,41 @@ def test_julia_repo_local(tmp_path):
env_dir, julia, 'local.jl --local-arg1 --local-arg2',
deps=deps, is_local=True,
) == expected


def _make_src_hook(tmp_path, pkg_code, script_code):
# here we have a package with a src dir and a script dir
src_dir = tmp_path.joinpath('src')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

feels like from this test this should get handled by the install process. the precedence of copying little bits out of this seems not great and we should find a way to do this step by step

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

this is in the tests, so we're setting up an example with test files which do get copied as part of the install process

src_dir.mkdir()
src_dir.joinpath('ExamplePkg.jl').write_text(pkg_code)

script_dir = tmp_path.joinpath('scripts')
script_dir.mkdir()
script_dir.joinpath('main.jl').write_text(script_code)

tmp_path.joinpath('Project.toml').write_text(
'name = "ExamplePkg"\n'
'uuid = "df230c44-b485-4b6a-bafb-763c50abe554"\n'
'[deps]\n'
'Example = "7876af07-990d-54b4-ab0e-23690620f79a"\n',
)


def test_julia_hook_src(tmp_path):
pkg_code = """
module ExamplePkg
using Example
export main
function main()
println("Hello, world!")
end
end
"""

script_code = """
using ExamplePkg
main()
"""
_make_src_hook(tmp_path, pkg_code, script_code)
expected = (0, b'Hello, world!\n')
assert run_language(tmp_path, julia, 'scripts/main.jl') == expected
Loading
Toggle all file notes Toggle all file annotations

Footer

© 2026 GitHub, Inc.