GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Julia language: skip startup.jl file by ericphanson · Pull Request #3496 · pre-commit/pre-commit Conversation
Contributor
Adds Split out from #3494 The first commit fails locally for me, showing that the test is effective: pytest tests -sk test_julia_hook_with_startup =========================================== test session starts =========================================== platform darwin -- Python 3.13.4, pytest-8.4.1, pluggy-1.6.0 rootdir: /Users/eph/pre-commit configfile: tox.ini plugins: env-1.1.5 collected 802 items / 801 deselected / 1 selected tests/languages/julia_test.py F ================================================ FAILURES ================================================= ______________________________________ test_julia_hook_with_startup _______________________________________ tmp_path = PosixPath('/private/var/folders/jb/plyyfc_d2bz195_0rc0n_zcw0000gp/T/pytest-of-eph/pytest-21/test_julia_hook_with_startup0') def test_julia_hook_with_startup(tmp_path): # We will temporarily use a new Julia depot so we can freely write a # startup.jl file existing_depot = os.getenv('JULIA_DEPOT_PATH') try: with tempfile.TemporaryDirectory() as depot_tempdir: os.environ['JULIA_DEPOT_PATH'] = depot_tempdir depot_path = Path(depot_tempdir) depot_path.joinpath('config').mkdir(exist_ok=True) startup = depot_path.joinpath('config', 'startup.jl') # write a startup.jl file that throws an error so # we know it's not used startup.write_text('error("Startup file used!")\n') # check that the test still succeeds even with a bad startup file > test_julia_hook(tmp_path) tests/languages/julia_test.py:49: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/languages/julia_test.py:32: in test_julia_hook assert run_language(tmp_path, julia, 'src/main.jl') == expected ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ testing/language_helpers.py:26: in run_language language.install_environment(prefix, version, deps) pre_commit/languages/julia.py:129: in install_environment cmd_output_b( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ check = True cmd = ('/Users/eph/.juliaup/bin/julia', '-e', '\n @assert length(ARGS) > 0\n hook_env = ARGS[1]\n deps ...ar/folders/jb/plyyfc_d2bz195_0rc0n_zcw0000gp/T/pytest-of-eph/pytest-21/test_julia_hook_with_startup0/juliaenv-default') kwargs = {'cwd': '/private/var/folders/jb/plyyfc_d2bz195_0rc0n_zcw0000gp/T/pytest-of-eph/pytest-21/test_julia_hook_with_startup0', 'stderr': -1, 'stdin': -1, 'stdout': -1} proc = <Popen: returncode: 1 args: ('/Users/eph/.juliaup/bin/julia', '-e', '\n ...>, stdout_b = b'' stderr_b = b'ERROR: LoadError: Startup file used!\nStacktrace:\n [1] error(s::String)\n @ Base ./error.jl:35\n [2] top-level sc...tup.jl:1\nin expression starting at /var/folders/jb/plyyfc_d2bz195_0rc0n_zcw0000gp/T/tmplwwx2crp/config/startup.jl:1\n' returncode = 1 def cmd_output_b( *cmd: str, check: bool = True, **kwargs: Any, ) -> tuple[int, bytes, bytes | None]: _setdefault_kwargs(kwargs) try: cmd = parse_shebang.normalize_cmd(cmd, env=kwargs.get('env')) except parse_shebang.ExecutableNotFoundError as e: returncode, stdout_b, stderr_b = e.to_output() else: try: proc = subprocess.Popen(cmd, **kwargs) except OSError as e: returncode, stdout_b, stderr_b = _oserror_to_output(e) else: stdout_b, stderr_b = proc.communicate() returncode = proc.returncode if check and returncode: > raise CalledProcessError(returncode, cmd, stdout_b, stderr_b) E pre_commit.util.CalledProcessError: command: ('/Users/eph/.juliaup/bin/julia', '-e', '\n @assert length(ARGS) > 0\n hook_env = ARGS[1]\n deps = join(ARGS[2:end], " ")\n\n # We prepend @stdlib here so that we can load the package manager even\n # though `get_env_patch` limits `JULIA_LOAD_PATH` to just the hook env.\n pushfirst!(LOAD_PATH, "@stdlib")\n using Pkg\n popfirst!(LOAD_PATH)\n\n # Instantiate the environment shipped with the hook repo. If we have\n # additional dependencies we disable precompilation in this step to\n # avoid double work.\n precompile = isempty(deps) ? "1" : "0"\n withenv("JULIA_PKG_PRECOMPILE_AUTO" => precompile) do\n Pkg.instantiate()\n end\n\n # Add additional dependencies (with precompilation)\n if !isempty(deps)\n withenv("JULIA_PKG_PRECOMPILE_AUTO" => "1") do\n Pkg.REPLMode.pkgstr("add " * deps)\n end\n end\n ', '--', '/private/var/folders/jb/plyyfc_d2bz195_0rc0n_zcw0000gp/T/pytest-of-eph/pytest-21/test_julia_hook_with_startup0/juliaenv-default') E return code: 1 E stdout: (none) E stderr: E ERROR: LoadError: Startup file used! E Stacktrace: E [1] error(s::String) E @ Base ./error.jl:35 E [2] top-level scope E @ /var/folders/jb/plyyfc_d2bz195_0rc0n_zcw0000gp/T/tmplwwx2crp/config/startup.jl:1 E in expression starting at /var/folders/jb/plyyfc_d2bz195_0rc0n_zcw0000gp/T/tmplwwx2crp/config/startup.jl:1 pre_commit/util.py:111: CalledProcessError ========================================= short test summary info ========================================= FAILED tests/languages/julia_test.py::test_julia_hook_with_startup - pre_commit.util.CalledProcessError: command: ('/Users/eph/.juliaup/bin/julia', '-e', '\n @asser... ==================================== 1 failed, 801 deselected in 1.30s ==================================== The second commit is the implementation change which shows that the the fix is effective: ❯ pytest tests -sk test_julia_hook_with_startup =========================================== test session starts =========================================== platform darwin -- Python 3.13.4, pytest-8.4.1, pluggy-1.6.0 rootdir: /Users/eph/pre-commit configfile: tox.ini plugins: env-1.1.5 collected 802 items / 801 deselected / 1 selected tests/languages/julia_test.py . ============================== 1 passed, 801 deselected in 64.48s (0:01:04) ===============================
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
asottile
force-pushed
the
eph/jl-startup
branch
from
ce7eae3 to
6f1f433
Compare
asottile
approved these changes
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
asottile
enabled auto-merge
tmeijn
pushed a commit
to tmeijn/dotfiles
that referenced
this pull request
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [pre-commit](https://github.com/pre-commit/pre-commit) | minor | `4.2.0` -> `4.3.0` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>pre-commit/pre-commit (pre-commit)</summary> ### [`v4.3.0`](https://github.com/pre-commit/pre-commit/blob/HEAD/CHANGELOG.md#430---2025-08-09) [Compare Source](pre-commit/pre-commit@v4.2.0...v4.3.0) \================== ##### Features - `language: docker` / `language: docker_image`: detect rootless docker. - [#​3446](pre-commit/pre-commit#3446) MR by [@​matthewhughes934](https://github.com/matthewhughes934). - [#​1243](pre-commit/pre-commit#1243) issue by [@​dkolepp](https://github.com/dkolepp). - `language: julia`: avoid `startup.jl` when executing hooks. - [#​3496](pre-commit/pre-commit#3496) MR by [@​ericphanson](https://github.com/ericphanson). - `language: dart`: support latest dart versions which require a higher sdk lower bound. - [#​3507](pre-commit/pre-commit#3507) MR by [@​bc-lee](https://github.com/bc-lee). </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS41OC4yIiwidXBkYXRlZEluVmVyIjoiNDEuNTguMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90Il19-->
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
None yet
MilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later. |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |