Squashed 'SpiffWorkflow/' changes from 2ca6ebf80..7b39b2235

7b39b2235 Merge pull request #300 from sartography/bugfix/remove-minidom-dependency
0642d48b1 remove minidom

git-subtree-dir: SpiffWorkflow
git-subtree-split: 7b39b223562eb510dd68c8d451922721ebb721a7
This commit is contained in:
Dan 2023-02-27 14:06:23 -05:00
parent 7a60c13f90
commit 8bebd09880
4 changed files with 12 additions and 4 deletions

View File

@ -6,6 +6,8 @@ import unittest
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
from lxml import etree
from SpiffWorkflow.specs.WorkflowSpec import WorkflowSpec
from SpiffWorkflow.task import Task
from SpiffWorkflow.serializer.prettyxml import XmlSerializer
@ -64,7 +66,7 @@ class PatternTest(unittest.TestCase):
# Test patterns that are defined in XML format.
if filename.endswith('.xml'):
with open(filename) as fp:
xml = fp.read()
xml = etree.parse(fp).getroot()
serializer = XmlSerializer()
wf_spec = WorkflowSpec.deserialize(
serializer, xml, filename=filename)

View File

@ -6,6 +6,8 @@ import os
data_dir = os.path.join(os.path.dirname(__file__), 'data')
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
from lxml import etree
from SpiffWorkflow.workflow import Workflow
from SpiffWorkflow.specs.Cancel import Cancel
from SpiffWorkflow.specs.Simple import Simple
@ -27,7 +29,7 @@ class WorkflowTest(unittest.TestCase):
"""
xml_file = os.path.join(data_dir, 'spiff', 'workflow1.xml')
with open(xml_file) as fp:
xml = fp.read()
xml = etree.parse(fp).getroot()
wf_spec = WorkflowSpec.deserialize(XmlSerializer(), xml)
workflow = Workflow(wf_spec)

View File

@ -4,6 +4,8 @@ import sys
import unittest
import os
from lxml import etree
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', '..'))
from SpiffWorkflow.specs.WorkflowSpec import WorkflowSpec
@ -30,7 +32,7 @@ class TaskSpecTest(unittest.TestCase):
os.path.dirname(__file__), '..', 'data', 'spiff', folder, f)
serializer = XmlSerializer()
with open(file) as fp:
xml = fp.read()
xml = etree.parse(fp).getroot()
self.wf_spec = WorkflowSpec.deserialize(
serializer, xml, filename=file)
self.workflow = Workflow(self.wf_spec)

View File

@ -8,6 +8,8 @@ import unittest
data_dir = os.path.join(os.path.dirname(__file__), '..', 'data')
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', '..'))
from lxml import etree
import pickle
from random import randint
try:
@ -82,7 +84,7 @@ class WorkflowSpecTest(unittest.TestCase):
# Read a complete workflow spec.
xml_file = os.path.join(data_dir, 'spiff', 'workflow1.xml')
with open(xml_file) as fp:
xml = fp.read()
xml = etree.parse(fp).getroot()
path_file = os.path.splitext(xml_file)[0] + '.path'
with open(path_file) as fp:
expected_path = fp.read().strip().split('\n')