From ef4c57a29bd92ba5c7c7ed9e50fd1260177f809d Mon Sep 17 00:00:00 2001 From: Enrico Minack Date: Tue, 5 Jul 2022 21:50:25 +0100 Subject: [PATCH] Make DropTestCaseBuilder instance truely stateless --- python/publish/junit.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/python/publish/junit.py b/python/publish/junit.py index 3bb87181..423d351f 100644 --- a/python/publish/junit.py +++ b/python/publish/junit.py @@ -84,12 +84,9 @@ def get_content(results: Union[Element, List[Element]]) -> str: class DropTestCaseBuilder(etree.TreeBuilder): - _stack = [] - - def parse(self, filepath): - self._stack.clear() - parser = etree.XMLParser(target=self) - return etree.parse(filepath, parser=parser) + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self._stack = [] def start(self, tag: Union[str, bytes], attrs: Dict[Union[str, bytes], Union[str, bytes]]) -> Element: self._stack.append(tag)