Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use sys.executable to obtain path to python command in tests, rather than assuming that python command is available in $PATH #4309

Merged
merged 1 commit into from
Aug 7, 2023

Conversation

boegel
Copy link
Member

@boegel boegel commented Aug 6, 2023

fix for failing test when python command is not available:

$ python3 -O -m test.framework.run test_run_cmd_script
Filtered RunTest tests using 'test_run_cmd_script', retained 1/21 tests: test_run_cmd_script
E
======================================================================
ERROR: test_run_cmd_script (__main__.RunTest)
Testing use of run_cmd with shell=False to call external scripts
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Volumes/work/easybuild-framework/test/framework/run.py", line 551, in test_run_cmd_script
    (out, ec) = run_cmd(py_test_script)
  File "/Volumes/work/easybuild-framework/easybuild/tools/run.py", line 91, in cache_aware_func
    res = func(cmd, *args, **kwargs)
  File "/Volumes/work/easybuild-framework/easybuild/tools/run.py", line 250, in run_cmd
    return complete_cmd(proc, cmd, cwd, start_time, cmd_log, log_ok=log_ok, log_all=log_all, simple=simple,
  File "/Volumes/work/easybuild-framework/easybuild/tools/run.py", line 354, in complete_cmd
    return parse_cmd_output(cmd, stdouterr, ec, simple, log_all, log_ok, regexp)
  File "/Volumes/work/easybuild-framework/easybuild/tools/run.py", line 643, in parse_cmd_output
    raise EasyBuildError('cmd "%s" exited with exit code %s and output:\n%s', cmd, ec, stdouterr)
easybuild.tools.build_log.EasyBuildError: 'cmd "/var/folders/rj/1hpwxbd90j7c2cg560n5g1640000gn/T/eb-5hxtrldj/eb-b2b3xts0/test.py" exited with exit code 127 and output:\nenv: python: No such file or directory\n'

----------------------------------------------------------------------
Ran 1 test in 0.227s

FAILED (errors=1)

…ming that 'python' command is available in $PATH
@boegel boegel changed the title use sys.executable to obtain path to python command, rather than assuming that python command is availanle in $PATH use sys.executable to obtain path to python command, rather than assuming that python command is available in $PATH Aug 6, 2023
@boegel boegel requested a review from ocaisa August 6, 2023 19:01
Copy link
Member

@ocaisa ocaisa left a comment

Choose a reason for hiding this comment

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

LGTM

@ocaisa ocaisa merged commit 1d83a04 into easybuilders:develop Aug 7, 2023
@boegel boegel deleted the fix_test_run_cmd_script branch August 7, 2023 20:38
@boegel boegel changed the title use sys.executable to obtain path to python command, rather than assuming that python command is available in $PATH use sys.executable to obtain path to python command in tests, rather than assuming that python command is available in $PATH Sep 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants