From a0006c87a69838b745d5c2dee4aa71fef1252807 Mon Sep 17 00:00:00 2001 From: Enrico Minack Date: Wed, 6 Jul 2022 12:12:14 +0100 Subject: [PATCH] Remove static state from DropTestCaseBuilder (#323) --- 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)