Skip to content

Commit

Permalink
fix parse_error_log_test
Browse files Browse the repository at this point in the history
  • Loading branch information
robnagler committed Oct 18, 2024
1 parent 275b07c commit 7d22944
Showing 1 changed file with 27 additions and 20 deletions.
47 changes: 27 additions & 20 deletions tests/parse_error_log_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.""",
)


Expand Down Expand Up @@ -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.""",
)

0 comments on commit 7d22944

Please sign in to comment.