From 7d2294404c6f975e827b9a33b0efe5a0be65bba8 Mon Sep 17 00:00:00 2001 From: robnagler <5495179+robnagler@users.noreply.github.com> Date: Fri, 18 Oct 2024 19:58:26 +0000 Subject: [PATCH] fix parse_error_log_test --- tests/parse_error_log_test.py | 47 ++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/tests/parse_error_log_test.py b/tests/parse_error_log_test.py index 2b38e529a8..2af1f8b08d 100644 --- a/tests/parse_error_log_test.py +++ b/tests/parse_error_log_test.py @@ -9,7 +9,34 @@ def setup_module(module): os.environ.update( + # Dev mode has to be false for these tests to pass PYKERN_PKCONFIG_DEV_MODE="0", + # Need to set these manually when in non-dev-mode + SIREPO_COOKIE_IS_SECURE="0", + SIREPO_COOKIE_PRIVATE_KEY="MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI=", + SIREPO_SMTP_PASSWORD="dev", + SIREPO_SMTP_SERVER="dev", + SIREPO_SMTP_USER="dev", + ) + + +def test_parse_python_errors(): + from sirepo.pkcli import job_cmd + from pykern.pkunit import pkeq + + err = """ +Traceback (most recent call last): + File "/home/vagrant/src/radiasoft/sirepo/sirepo/pkcli/zgoubi.py", line 120, in _validate_estimate_output_file_size + 'Estimated FAI output too large.\n' +AssertionError: Estimated FAI output too large. +Reduce particle count or number of runs, +or increase diagnostic interval. +""" + pkeq( + job_cmd._parse_python_errors(err), + """Estimated FAI output too large. +Reduce particle count or number of runs, +or increase diagnostic interval.""", ) @@ -38,23 +65,3 @@ def test_runError(fc): d = fc.sr_post("runStatus", d.nextRequest) else: pkunit.pkfail("Error never returned d={}", d) - - -def test_parse_python_errors(): - from sirepo.pkcli import job_cmd - from pykern.pkunit import pkeq - - err = """ -Traceback (most recent call last): - File "/home/vagrant/src/radiasoft/sirepo/sirepo/pkcli/zgoubi.py", line 120, in _validate_estimate_output_file_size - 'Estimated FAI output too large.\n' -AssertionError: Estimated FAI output too large. -Reduce particle count or number of runs, -or increase diagnostic interval. -""" - pkeq( - job_cmd._parse_python_errors(err), - """Estimated FAI output too large. -Reduce particle count or number of runs, -or increase diagnostic interval.""", - )