Пример #1
0
    def run_pattern(self, filename):
        # Load the .path file.
        path_file = os.path.splitext(filename)[0] + '.path'
        if os.path.exists(path_file):
            expected_path = open(path_file).read()
        else:
            expected_path = None

        # Load the .data file.
        data_file = os.path.splitext(filename)[0] + '.data'
        if os.path.exists(data_file):
            expected_data = open(data_file, 'r').read()
        else:
            expected_data = None

        # Test patterns that are defined in XML format.
        if filename.endswith('.xml'):
            xml = open(filename).read()
            wf_spec = WorkflowSpec.deserialize(self.serializer,
                                               xml,
                                               filename=filename)
            run_workflow(self, wf_spec, expected_path, expected_data)

        # Test patterns that are defined in Python.
        if filename.endswith('.py') and not filename.endswith('__.py'):
            code = compile(open(filename).read(), filename, 'exec')
            thedict = {}
            result = eval(code, thedict)
            wf_spec = thedict['TestWorkflowSpec']()
            run_workflow(self, wf_spec, expected_path, expected_data)
Пример #2
0
    def run_pattern(self, filename):
        # Load the .path file.
        path_file = os.path.splitext(filename)[0] + ".path"
        if os.path.exists(path_file):
            expected_path = open(path_file).read()
        else:
            expected_path = None

        # Load the .data file.
        data_file = os.path.splitext(filename)[0] + ".data"
        if os.path.exists(data_file):
            expected_data = open(data_file, "r").read()
        else:
            expected_data = None

        # Test patterns that are defined in XML format.
        if filename.endswith(".xml"):
            xml = open(filename).read()
            wf_spec = WorkflowSpec.deserialize(self.serializer, xml, filename=filename)
            run_workflow(self, wf_spec, expected_path, expected_data)

        # Test patterns that are defined in Python.
        if filename.endswith(".py") and not filename.endswith("__.py"):
            code = compile(open(filename).read(), filename, "exec")
            thedict = {}
            result = eval(code, thedict)
            wf_spec = thedict["TestWorkflowSpec"]()
            run_workflow(self, wf_spec, expected_path, expected_data)
Пример #3
0
    def testPattern(self):
        for basedir in self.xml_path:
            dirname = os.path.join(os.path.dirname(__file__), basedir)

            for filename in os.listdir(dirname):
                if not filename.endswith(('.xml', '.py')):
                    continue
                filename = os.path.join(dirname, filename)
                print filename

                # Load the .path file.
                path_file = os.path.splitext(filename)[0] + '.path'
                if os.path.exists(path_file):
                    expected_path = open(path_file).read()
                else:
                    expected_path = None

                # Load the .data file.
                data_file = os.path.splitext(filename)[0] + '.data'
                if os.path.exists(data_file):
                    expected_data = open(data_file, 'r').read()
                else:
                    expected_data = None

                # Test patterns that are defined in XML format.
                if filename.endswith('.xml'):
                    xml = open(filename).read()
                    wf_spec = WorkflowSpec.deserialize(self.serializer,
                                                       xml,
                                                       filename=filename)
                    run_workflow(self, wf_spec, expected_path, expected_data)

                # Test patterns that are defined in Python.
                if filename.endswith('.py') and not filename.endswith('__.py'):
                    code = compile(open(filename).read(), filename, 'exec')
                    thedict = {}
                    result = eval(code, thedict)
                    wf_spec = thedict['TestWorkflowSpec']()
                    run_workflow(self, wf_spec, expected_path, expected_data)
Пример #4
0
    def testPattern(self):
        for basedir in self.xml_path:
            dirname = os.path.join(os.path.dirname(__file__), basedir)

            for filename in os.listdir(dirname):
                if not filename.endswith(('.xml', '.py')):
                    continue
                filename = os.path.join(dirname, filename)
                print filename

                # Load the .path file.
                path_file = os.path.splitext(filename)[0] + '.path'
                if os.path.exists(path_file):
                    expected_path = open(path_file).read()
                else:
                    expected_path = None

                # Load the .data file.
                data_file = os.path.splitext(filename)[0] + '.data'
                if os.path.exists(data_file):
                    expected_data = open(data_file, 'r').read()
                else:
                    expected_data = None

                # Test patterns that are defined in XML format.
                if filename.endswith('.xml'):
                    xml     = open(filename).read()
                    wf_spec = WorkflowSpec.deserialize(self.serializer, xml, filename = filename)
                    run_workflow(self, wf_spec, expected_path, expected_data)

                # Test patterns that are defined in Python.
                if filename.endswith('.py') and not filename.endswith('__.py'):
                    code    = compile(open(filename).read(), filename, 'exec')
                    thedict = {}
                    result  = eval(code, thedict)
                    wf_spec = thedict['TestWorkflowSpec']()
                    run_workflow(self, wf_spec, expected_path, expected_data)
 def testWorkflowSpec(self):
     for test in self.workflows:
         print(test.filename)
         run_workflow(self, test.spec, test.path, test.data)