Skip to content

use "/usr/bin/env python" in test_run_cmd_script #4241

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

Merged
merged 1 commit into from
Apr 15, 2023

Conversation

branfosj
Copy link
Member

The system I am running the tests on does not have /usr/bin/python, so this test fails.

======================================================================
ERROR: test_run_cmd_script (test.framework.run.RunTest)
Testing use of run_cmd with shell=False to call external scripts
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/simon/work/easybuild-framework/test/framework/run.py", line 550, in test_run_cmd_script
    (out, ec) = run_cmd(py_test_script)
  File "/home/simon/work/easybuild-framework/easybuild/tools/run.py", line 90, in cache_aware_func
    res = func(cmd, *args, **kwargs)
  File "/home/simon/work/easybuild-framework/easybuild/tools/run.py", line 250, in run_cmd
    regexp=regexp, stream_output=stream_output, trace=trace)
  File "/home/simon/work/easybuild-framework/easybuild/tools/run.py", line 353, in complete_cmd
    return parse_cmd_output(cmd, stdouterr, ec, simple, log_all, log_ok, regexp)
  File "/home/simon/work/easybuild-framework/easybuild/tools/run.py", line 642, 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 "/tmp/eb-5s0adni4/eb-i46nvily/eb-fk75l1ha/test.py" exited with exit code 126 and output:\n/bin/bash: /tmp/eb-5s0adni4/eb-i46nvily/eb-fk75l1ha/test.py: /usr/bin/python: bad interpreter: No such file or directory\n'

----------------------------------------------------------------------

@@ -543,7 +543,7 @@ def test_run_cmd_script(self):
"""Testing use of run_cmd with shell=False to call external scripts"""
py_test_script = os.path.join(self.test_prefix, 'test.py')
write_file(py_test_script, '\n'.join([
'#!/usr/bin/python',
'#!/usr/bin/env python',
Copy link
Member

Choose a reason for hiding this comment

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

Is this sufficient? Should we also consider systems that only have python3, not python?

Copy link
Member Author

Choose a reason for hiding this comment

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

As this is targeting develop we cannot assume that we are using python3

Copy link
Member

Choose a reason for hiding this comment

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

True, so good as is

@boegel boegel added this to the next release (4.7.2) milestone Apr 15, 2023
Copy link
Member

@boegel boegel left a comment

Choose a reason for hiding this comment

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

lgtm

@boegel boegel merged commit f725e61 into easybuilders:develop Apr 15, 2023
@branfosj branfosj deleted the env branch April 15, 2023 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants