Skip to content

Commit

Permalink
Fix black issues SO107 SCMSUITE-8725
Browse files Browse the repository at this point in the history
  • Loading branch information
dormrod committed Dec 5, 2024
1 parent 8686f88 commit f559af6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
6 changes: 5 additions & 1 deletion core/jobrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,11 @@ def _run_job(self, job, jobmanager):
# Log any error messages to the standard logger
if not job.check():
# get_errormsg is not required by the base job class, but often implemented by convention
err_msg = job.get_errormsg() if hasattr(job, "get_errormsg") else "Could not determine error message. Please check the output manually."
err_msg = (
job.get_errormsg()
if hasattr(job, "get_errormsg")
else "Could not determine error message. Please check the output manually."
)
err_lines = err_msg.splitlines()
max_lines = 20
if len(err_lines) > max_lines:
Expand Down
22 changes: 10 additions & 12 deletions unit_tests/test_basejob.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,16 +333,14 @@ def test_job_errors_logged_to_stdout(self, config):
job1.run()
job2.run()

assert (
f"""Error message for job {job1.name} was:
./{job1.name}.run: line 3: not_a_cmd: command not found"""
in mock_stdout.getvalue()
stdout = mock_stdout.getvalue()
assert re.match(
f".*Error message for job {job1.name} was:.* 3: not_a_cmd: (command ){{0,1}}not found",
stdout,
re.DOTALL,
)
assert re.match(
f".*Error message for job {job2.name} was:.* 3: x: (command ){{0,1}}not found.* 22: x: (command ){{0,1}}not found.*(see output for full error)",
stdout,
re.DOTALL,
)

assert (
f"""
./{job2.name}.run: line 21: x: command not found
./{job2.name}.run: line 22: x: command not found
... (see output for full error)"""
in mock_stdout.getvalue()
)

0 comments on commit f559af6

Please sign in to comment.