From 8bebd0988057d61015675e6ae931069d0a7d2b40 Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 27 Feb 2023 14:06:23 -0500 Subject: [PATCH] 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 --- tests/SpiffWorkflow/PatternTest.py | 4 +++- tests/SpiffWorkflow/WorkflowTest.py | 4 +++- tests/SpiffWorkflow/specs/SubWorkflowTest.py | 4 +++- tests/SpiffWorkflow/specs/WorkflowSpecTest.py | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/SpiffWorkflow/PatternTest.py b/tests/SpiffWorkflow/PatternTest.py index f0d013ce0..85a90d271 100644 --- a/tests/SpiffWorkflow/PatternTest.py +++ b/tests/SpiffWorkflow/PatternTest.py @@ -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) diff --git a/tests/SpiffWorkflow/WorkflowTest.py b/tests/SpiffWorkflow/WorkflowTest.py index 0d2b0b3d0..273ced0d7 100644 --- a/tests/SpiffWorkflow/WorkflowTest.py +++ b/tests/SpiffWorkflow/WorkflowTest.py @@ -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) diff --git a/tests/SpiffWorkflow/specs/SubWorkflowTest.py b/tests/SpiffWorkflow/specs/SubWorkflowTest.py index 0590192f9..3e99f9931 100644 --- a/tests/SpiffWorkflow/specs/SubWorkflowTest.py +++ b/tests/SpiffWorkflow/specs/SubWorkflowTest.py @@ -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) diff --git a/tests/SpiffWorkflow/specs/WorkflowSpecTest.py b/tests/SpiffWorkflow/specs/WorkflowSpecTest.py index c2a5638e4..1ad5b1256 100644 --- a/tests/SpiffWorkflow/specs/WorkflowSpecTest.py +++ b/tests/SpiffWorkflow/specs/WorkflowSpecTest.py @@ -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')