From 4cb7e51f99a0745e1f578a606c7dbbedd9c07897 Mon Sep 17 00:00:00 2001 From: David Ormrod Morley Date: Thu, 5 Dec 2024 14:05:47 +0100 Subject: [PATCH] Fix black issues SO107 SCMSUITE-8725 --- core/jobrunner.py | 6 +++++- unit_tests/test_basejob.py | 20 ++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/core/jobrunner.py b/core/jobrunner.py index 04b5e8f5..84944d5d 100644 --- a/core/jobrunner.py +++ b/core/jobrunner.py @@ -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: diff --git a/unit_tests/test_basejob.py b/unit_tests/test_basejob.py index 87c852b7..c90cfe4e 100644 --- a/unit_tests/test_basejob.py +++ b/unit_tests/test_basejob.py @@ -333,16 +333,12 @@ 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 not found", stdout, re.DOTALL + ) + assert re.match( + f".*Error message for job {job2.name} was:.* 3: x: command not found.* 22: x: command 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() - )