You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by hu...@apache.org on 2024/08/19 06:45:00 UTC

(plc4x) branch feat/plc4py/test_runner created (now 5f538f77da)

This is an automated email from the ASF dual-hosted git repository.

hutcheb pushed a change to branch feat/plc4py/test_runner
in repository https://gitbox.apache.org/repos/asf/plc4x.git


      at 5f538f77da feat(plc4py): XML Test Suite Loader initial outline

This branch includes the following new commits:

     new 5f538f77da feat(plc4py): XML Test Suite Loader initial outline

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(plc4x) 01/01: feat(plc4py): XML Test Suite Loader initial outline

Posted by hu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hutcheb pushed a commit to branch feat/plc4py/test_runner
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 5f538f77da83e66b340c59915ae1f2dd65d63bca
Author: hutcheb <be...@gmail.com>
AuthorDate: Mon Aug 19 14:41:43 2024 +0800

    feat(plc4py): XML Test Suite Loader initial outline
---
 plc4py/plc4py/utils/XmlTestSuiteLoader.py | 50 +++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/plc4py/plc4py/utils/XmlTestSuiteLoader.py b/plc4py/plc4py/utils/XmlTestSuiteLoader.py
new file mode 100644
index 0000000000..f621e5e75e
--- /dev/null
+++ b/plc4py/plc4py/utils/XmlTestSuiteLoader.py
@@ -0,0 +1,50 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+import unittest
+from abc import abstractmethod, ABC
+from dataclasses import dataclass, field
+from typing import Any, Iterator
+from xml.etree import ElementTree
+
+
+class ParserSerializerTestSuite:
+    # TODO:- Do something with this
+    pass
+
+
+class TestCase:
+    # TODO:- Do something with this
+    pass
+
+
+@dataclass
+class XmlTestSuiteLoader(unittest.TestLoader, ABC):
+    # Parent class for test suites utilizing XML as representation mechanism.
+    # <p>
+    # It adds handling of resource loading and helps in navigating test framework to suite source files.
+    #
+
+    test_suite_document: str
+    test_suite_document_xml: Iterator[tuple[str, Any]] = field(init=False)
+
+    def __post_init__(self) -> None:
+        self.test_suite_document_xml = ElementTree.iterparse(self.test_suite_document)
+
+    @abstractmethod
+    def run(self, test_suite: ParserSerializerTestSuite, test_case: TestCase) -> Iterator[unittest.TestResult]:
+        # Actually run the test suite
+        pass