Skip to content

Commit 809c263

Browse files
kannon92mr-c
authored andcommitted
feat: format
1 parent 2d916a0 commit 809c263

File tree

2 files changed

+18
-21
lines changed

2 files changed

+18
-21
lines changed

cwltool/job.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,10 @@ def _execute(
314314
raise WorkflowException(f"{self.stdin} missing from pathmapper")
315315
else:
316316
stdin_path = rmap[1]
317-
def stderr_stdout_log_path(base_path_logs, stderr_or_stdout) -> Optional[str]:
317+
318+
def stderr_stdout_log_path(
319+
base_path_logs, stderr_or_stdout
320+
) -> Optional[str]:
318321
if stderr_or_stdout is not None:
319322
abserr = os.path.join(base_path_logs, stderr_or_stdout)
320323
dnerr = os.path.dirname(abserr)
@@ -393,13 +396,16 @@ def stderr_stdout_log_path(base_path_logs, stderr_or_stdout) -> Optional[str]:
393396
# Move logs from log location to final output
394397
if self.outdir != self.base_path_logs:
395398
if stdout_path:
396-
new_stdout_path = stdout_path.replace(self.base_path_logs, self.outdir)
399+
new_stdout_path = stdout_path.replace(
400+
self.base_path_logs, self.outdir
401+
)
397402
shutil.copy2(stdout_path, new_stdout_path)
398403
if stderr_path:
399-
new_stderr_path = stderr_path.replace(self.base_path_logs, self.outdir)
404+
new_stderr_path = stderr_path.replace(
405+
self.base_path_logs, self.outdir
406+
)
400407
shutil.copy2(stderr_path, new_stderr_path)
401408

402-
403409
outputs = self.collect_outputs(self.outdir, rcode)
404410
outputs = bytes2str_in_dicts(outputs) # type: ignore
405411
except OSError as e:

tests/test_stdout_stderr_log_dir.py

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,19 @@
66

77
from .util import get_main_output, needs_docker
88

9+
910
def test_log_dir_echo_output() -> None:
1011
_, stdout, stderr = get_main_output(
11-
[
12-
"--log-dir",
13-
"logs",
14-
"tests/echo.cwl",
15-
"--inp", "hello"
16-
]
12+
["--log-dir", "logs", "tests/echo.cwl", "--inp", "hello"]
1713
)
1814
assert "completed success" in stderr, stderr
19-
assert json.loads(stdout)['out'].strip('\n') == 'hello'
15+
assert json.loads(stdout)["out"].strip("\n") == "hello"
16+
2017

2118
def test_log_dir_echo_no_output() -> None:
2219
_, stdout, stderr = get_main_output(
23-
[
24-
"--log-dir",
25-
"logs",
26-
"tests/echo-stdout-log-dir.cwl",
27-
"--inp", "hello"
28-
]
20+
["--log-dir", "logs", "tests/echo-stdout-log-dir.cwl", "--inp", "hello"]
2921
)
30-
for dir in os.listdir('logs'):
31-
for file in os.listdir(f'logs/{dir}'):
32-
assert file == 'out.txt'
33-
22+
for dir in os.listdir("logs"):
23+
for file in os.listdir(f"logs/{dir}"):
24+
assert file == "out.txt"

0 commit comments

Comments
 (0)