mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Merge 3957ac8622 into 8416413a0e
This commit is contained in:
commit
74d5327dda
3 changed files with 28 additions and 2 deletions
7
.github/workflows/languages.yaml
vendored
7
.github/workflows/languages.yaml
vendored
|
|
@ -67,7 +67,12 @@ jobs:
|
||||||
if: matrix.language == 'haskell'
|
if: matrix.language == 'haskell'
|
||||||
- uses: r-lib/actions/setup-r@v2
|
- uses: r-lib/actions/setup-r@v2
|
||||||
if: matrix.os == 'ubuntu-latest' && matrix.language == 'r'
|
if: matrix.os == 'ubuntu-latest' && matrix.language == 'r'
|
||||||
|
- uses: julia-actions/install-juliaup@v2
|
||||||
|
if: matrix.language == 'julia'
|
||||||
|
with:
|
||||||
|
channel: 'release'
|
||||||
|
- run: juliaup add 1.10.10
|
||||||
|
if: matrix.language == 'julia'
|
||||||
- name: install deps
|
- name: install deps
|
||||||
run: python -mpip install -e . -r requirements-dev.txt
|
run: python -mpip install -e . -r requirements-dev.txt
|
||||||
- name: run tests
|
- name: run tests
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,13 @@ def run_hook(
|
||||||
def get_env_patch(target_dir: str, version: str) -> PatchesT:
|
def get_env_patch(target_dir: str, version: str) -> PatchesT:
|
||||||
return (
|
return (
|
||||||
('JULIA_LOAD_PATH', target_dir),
|
('JULIA_LOAD_PATH', target_dir),
|
||||||
# May be set, remove it to not interfer with LOAD_PATH
|
# May be set, remove it to not interfere with LOAD_PATH
|
||||||
('JULIA_PROJECT', UNSET),
|
('JULIA_PROJECT', UNSET),
|
||||||
|
# Only set JULIAUP_CHANNEL if we don't want use the system's default
|
||||||
|
*(
|
||||||
|
(('JULIAUP_CHANNEL', version),)
|
||||||
|
if version not in ('system', 'default') else ()
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,22 @@ def test_julia_hook(tmp_path):
|
||||||
assert run_language(tmp_path, julia, 'src/main.jl') == expected
|
assert run_language(tmp_path, julia, 'src/main.jl') == expected
|
||||||
|
|
||||||
|
|
||||||
|
def test_julia_hook_version(tmp_path):
|
||||||
|
code = """
|
||||||
|
using Example
|
||||||
|
function main()
|
||||||
|
println("Hello, Julia $(VERSION)!")
|
||||||
|
end
|
||||||
|
main()
|
||||||
|
"""
|
||||||
|
_make_hook(tmp_path, code)
|
||||||
|
expected = (0, b'Hello, Julia 1.10.10!\n')
|
||||||
|
assert run_language(
|
||||||
|
tmp_path, julia, 'src/main.jl',
|
||||||
|
version='1.10.10',
|
||||||
|
) == expected
|
||||||
|
|
||||||
|
|
||||||
def test_julia_hook_with_startup(tmp_path):
|
def test_julia_hook_with_startup(tmp_path):
|
||||||
depot_path = tmp_path.joinpath('depot')
|
depot_path = tmp_path.joinpath('depot')
|
||||||
depot_path.joinpath('config').mkdir(parents=True)
|
depot_path.joinpath('config').mkdir(parents=True)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue