Revert "remove DATA line" #446
GitHub Actions / Test Results
failed
Sep 12, 2024 in 0s
2 fail, 6 pass in 4s
Annotations
Check warning on line 0 in test_create_experiment
github-actions / Test Results
test_create_experiment (test_create_experiment) failed
ci/scripts/tests/test-results.xml [took 0s]
Raw output
wxflow.executable.ProcessError: Command exited with status 1:
'/home/runner/work/global-workflow/global-workflow/workflow/create_experiment.py' '-y' '../../cases/pr/C48_ATM.yaml' '--overwrite'
def test_create_experiment():
create_experiment_script = Executable(f'{HOMEgfs}/workflow/create_experiment.py')
yaml_dir = yaml_dir = os.path.join(HOMEgfs, 'ci/cases/pr')
env = os.environ.copy()
env['RUNTESTS'] = RUNDIR
for case in os.listdir(yaml_dir):
if case.endswith('.yaml'):
with open(os.path.join(yaml_dir, case), 'r') as file:
file_contents = file.read()
if 'ICSDIR_ROOT' not in file_contents:
create_experiment = copy.deepcopy(create_experiment_script)
create_experiment.add_default_arg(['-y', f'../../cases/pr/{case}', '--overwrite'])
env['pslot'] = os.path.splitext(case)[0]
> create_experiment(env=env)
test_create_experiment.py:26:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <exe: ['/home/runner/work/global-workflow/global-workflow/workflow/create_experiment.py', '-y', '../../cases/pr/C48_ATM.yaml', '--overwrite']>
args = ()
kwargs = {'env': {'ACCEPT_EULA': 'Y', 'ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE': '/opt/actionarchivecache', 'AGENT_TOOLSDIRECTORY': '/opt/hostedtoolcache', 'ANDROID_HOME': '/usr/local/lib/android/sdk', ...}}
env_arg = {'ACCEPT_EULA': 'Y', 'ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE': '/opt/actionarchivecache', 'AGENT_TOOLSDIRECTORY': '/opt/hostedtoolcache', 'ANDROID_HOME': '/usr/local/lib/android/sdk', ...}
env = {'ACCEPT_EULA': 'Y', 'ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE': '/opt/actionarchivecache', 'AGENT_TOOLSDIRECTORY': '/opt/hostedtoolcache', 'ANDROID_HOME': '/usr/local/lib/android/sdk', ...}
fail_on_error = True, ignore_errors = (), output = None, error = None
input = None
streamify = <function Executable.__call__.<locals>.streamify at 0x7fd5fb4bede0>
istream = None, close_istream = False
def __call__(self, *args, **kwargs):
"""
Run this executable in a subprocess.
Parameters:
-----------
*args (str): Command-line arguments to the executable to run
Keyword Arguments:
------------------
_dump_env : Dict
Dict to be set to the environment actually
used (envisaged for testing purposes only)
env : Dict
The environment with which to run the executable
fail_on_error : bool
Raise an exception if the subprocess returns
an error. Default is True. The return code is available as
``exe.returncode``
ignore_errors : int or List
A list of error codes to ignore.
If these codes are returned, this process will not raise
an exception even if ``fail_on_error`` is set to ``True``
input :
Where to read stdin from
output :
Where to send stdout
error :
Where to send stderr
Accepted values for input, output, and error:
* python streams, e.g. open Python file objects, or ``os.devnull``
* filenames, which will be automatically opened for writing
* ``str``, as in the Python string type. If you set these to ``str``,
output and error will be written to pipes and returned as a string.
If both ``output`` and ``error`` are set to ``str``, then one string
is returned containing output concatenated with error. Not valid
for ``input``
* ``str.split``, as in the ``split`` method of the Python string type.
Behaves the same as ``str``, except that value is also written to
``stdout`` or ``stderr``.
By default, the subprocess inherits the parent's file descriptors.
"""
# Environment
env_arg = kwargs.get("env", None)
# Setup default environment
env = os.environ.copy() if env_arg is None else {}
env.update(self.default_env)
# Apply env argument
if env_arg:
env.update(env_arg)
if "_dump_env" in kwargs:
kwargs["_dump_env"].clear()
kwargs["_dump_env"].update(env)
fail_on_error = kwargs.pop("fail_on_error", True)
ignore_errors = kwargs.pop("ignore_errors", ())
# If they just want to ignore one error code, make it a tuple.
if isinstance(ignore_errors, int):
ignore_errors = (ignore_errors,)
output = kwargs.pop("output", None)
error = kwargs.pop("error", None)
input = kwargs.pop("input", None)
if input is str:
raise ValueError("Cannot use `str` as input stream.")
def streamify(arg, mode):
if isinstance(arg, str):
return open(arg, mode), True
elif arg in (str, str.split):
return subprocess.PIPE, False
else:
return arg, False
istream, close_istream = streamify(input, "r")
ostream, close_ostream = streamify(output, "w")
estream, close_estream = streamify(error, "w")
cmd = self.exe + list(args)
escaped_cmd = ["'%s'" % arg.replace("'", "'\"'\"'") for arg in cmd]
cmd_line_string = " ".join(escaped_cmd)
proc = None # initialize to avoid lint warning
try:
proc = subprocess.Popen(cmd, stdin=istream, stderr=estream, stdout=ostream, env=env, close_fds=False)
out, err = proc.communicate()
result = None
if output in (str, str.split) or error in (str, str.split):
result = ""
if output in (str, str.split):
outstr = str(out.decode("utf-8"))
result += outstr
if output is str.split:
sys.stdout.write(outstr)
if error in (str, str.split):
errstr = str(err.decode("utf-8"))
result += errstr
if error is str.split:
sys.stderr.write(errstr)
rc = self.returncode = proc.returncode
if fail_on_error and rc != 0 and (rc not in ignore_errors):
long_msg = cmd_line_string
if result:
# If the output is not captured in the result, it will have
# been stored either in the specified files (e.g. if
# 'output' specifies a file) or written to the parent's
# stdout/stderr (e.g. if 'output' is not specified)
long_msg += "\n" + result
> raise ProcessError(f"Command exited with status {proc.returncode}:", long_msg)
E wxflow.executable.ProcessError: Command exited with status 1:
E '/home/runner/work/global-workflow/global-workflow/workflow/create_experiment.py' '-y' '../../cases/pr/C48_ATM.yaml' '--overwrite'
wxflow/executable.py:230: ProcessError
Check warning on line 0 in test_setup
github-actions / Test Results
test_setup_xml (test_setup) failed
ci/scripts/tests/test-results.xml [took 0s]
Raw output
wxflow.executable.ProcessError: Command exited with status 1:
'/home/runner/work/global-workflow/global-workflow/workflow/setup_xml.py' '/home/runner/work/global-workflow/global-workflow/ci/scripts/tests/testdata/RUNDIR/C48_ATM'
def test_setup_xml():
setup_xml_script = Executable(os.path.join(HOMEgfs, "workflow/setup_xml.py"))
setup_xml_script.add_default_arg(f"{RUNDIR}/{pslot}")
> setup_xml_script()
test_setup.py:32:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <exe: ['/home/runner/work/global-workflow/global-workflow/workflow/setup_xml.py', '/home/runner/work/global-workflow/global-workflow/ci/scripts/tests/testdata/RUNDIR/C48_ATM']>
args = (), kwargs = {}, env_arg = None
env = {'ACCEPT_EULA': 'Y', 'ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE': '/opt/actionarchivecache', 'AGENT_TOOLSDIRECTORY': '/opt/hostedtoolcache', 'ANDROID_HOME': '/usr/local/lib/android/sdk', ...}
fail_on_error = True, ignore_errors = (), output = None, error = None
input = None
streamify = <function Executable.__call__.<locals>.streamify at 0x7fd5fb53d260>
istream = None, close_istream = False
def __call__(self, *args, **kwargs):
"""
Run this executable in a subprocess.
Parameters:
-----------
*args (str): Command-line arguments to the executable to run
Keyword Arguments:
------------------
_dump_env : Dict
Dict to be set to the environment actually
used (envisaged for testing purposes only)
env : Dict
The environment with which to run the executable
fail_on_error : bool
Raise an exception if the subprocess returns
an error. Default is True. The return code is available as
``exe.returncode``
ignore_errors : int or List
A list of error codes to ignore.
If these codes are returned, this process will not raise
an exception even if ``fail_on_error`` is set to ``True``
input :
Where to read stdin from
output :
Where to send stdout
error :
Where to send stderr
Accepted values for input, output, and error:
* python streams, e.g. open Python file objects, or ``os.devnull``
* filenames, which will be automatically opened for writing
* ``str``, as in the Python string type. If you set these to ``str``,
output and error will be written to pipes and returned as a string.
If both ``output`` and ``error`` are set to ``str``, then one string
is returned containing output concatenated with error. Not valid
for ``input``
* ``str.split``, as in the ``split`` method of the Python string type.
Behaves the same as ``str``, except that value is also written to
``stdout`` or ``stderr``.
By default, the subprocess inherits the parent's file descriptors.
"""
# Environment
env_arg = kwargs.get("env", None)
# Setup default environment
env = os.environ.copy() if env_arg is None else {}
env.update(self.default_env)
# Apply env argument
if env_arg:
env.update(env_arg)
if "_dump_env" in kwargs:
kwargs["_dump_env"].clear()
kwargs["_dump_env"].update(env)
fail_on_error = kwargs.pop("fail_on_error", True)
ignore_errors = kwargs.pop("ignore_errors", ())
# If they just want to ignore one error code, make it a tuple.
if isinstance(ignore_errors, int):
ignore_errors = (ignore_errors,)
output = kwargs.pop("output", None)
error = kwargs.pop("error", None)
input = kwargs.pop("input", None)
if input is str:
raise ValueError("Cannot use `str` as input stream.")
def streamify(arg, mode):
if isinstance(arg, str):
return open(arg, mode), True
elif arg in (str, str.split):
return subprocess.PIPE, False
else:
return arg, False
istream, close_istream = streamify(input, "r")
ostream, close_ostream = streamify(output, "w")
estream, close_estream = streamify(error, "w")
cmd = self.exe + list(args)
escaped_cmd = ["'%s'" % arg.replace("'", "'\"'\"'") for arg in cmd]
cmd_line_string = " ".join(escaped_cmd)
proc = None # initialize to avoid lint warning
try:
proc = subprocess.Popen(cmd, stdin=istream, stderr=estream, stdout=ostream, env=env, close_fds=False)
out, err = proc.communicate()
result = None
if output in (str, str.split) or error in (str, str.split):
result = ""
if output in (str, str.split):
outstr = str(out.decode("utf-8"))
result += outstr
if output is str.split:
sys.stdout.write(outstr)
if error in (str, str.split):
errstr = str(err.decode("utf-8"))
result += errstr
if error is str.split:
sys.stderr.write(errstr)
rc = self.returncode = proc.returncode
if fail_on_error and rc != 0 and (rc not in ignore_errors):
long_msg = cmd_line_string
if result:
# If the output is not captured in the result, it will have
# been stored either in the specified files (e.g. if
# 'output' specifies a file) or written to the parent's
# stdout/stderr (e.g. if 'output' is not specified)
long_msg += "\n" + result
> raise ProcessError(f"Command exited with status {proc.returncode}:", long_msg)
E wxflow.executable.ProcessError: Command exited with status 1:
E '/home/runner/work/global-workflow/global-workflow/workflow/setup_xml.py' '/home/runner/work/global-workflow/global-workflow/ci/scripts/tests/testdata/RUNDIR/C48_ATM'
wxflow/executable.py:230: ProcessError
Loading