Skip to content
This repository has been archived by the owner on Jul 19, 2021. It is now read-only.

Commit

Permalink
Add missing sys import
Browse files Browse the repository at this point in the history
And fixed minor bug
  • Loading branch information
Lars Petter Øren Hauge authored and lars-petter-hauge committed Apr 3, 2019
1 parent 6b55f02 commit 256deec
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion python/res/job_queue/workflow.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import time
import sys
from res.config import ConfigError
from cwrap import BaseCClass
from res import ResPrototype
Expand Down Expand Up @@ -66,7 +67,7 @@ def run(self, ert, verbose=False, context=None):
if not success:
msg = "** Warning: The workflow file {} is not valid - "\
"make sure the workflow jobs are defined accordingly\n"
sys.stderr.write(msg.format(workflow.src_file))
sys.stderr.write(msg.format(self.src_file))

self.__running = False
return False
Expand Down
14 changes: 14 additions & 0 deletions python/tests/res/job_queue/test_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,17 @@ def test_workflow_run(self):

with open("dump2", "r") as f:
self.assertEqual(f.read(), "dump_text_2")


def test_failing_workflow_run(self):
with TestAreaContext("python/job_queue/workflow") as work_area:
WorkflowCommon.createExternalDumpJob()

joblist = WorkflowJoblist()
self.assertTrue(joblist.addJobFromFile("DUMP", "dump_job"))
self.assertTrue("DUMP" in joblist)

workflow = Workflow("undefined", joblist)
context = SubstitutionList()

self.assertFalse(workflow.run(None, verbose=True, context=context))

0 comments on commit 256deec

Please sign in to comment.