junitparser 4.0.0__tar.gz → 4.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {junitparser-4.0.0/junitparser.egg-info → junitparser-4.0.2}/PKG-INFO +1 -1
- {junitparser-4.0.0 → junitparser-4.0.2}/junitparser/__init__.py +1 -1
- {junitparser-4.0.0 → junitparser-4.0.2}/junitparser/junitparser.py +6 -2
- {junitparser-4.0.0 → junitparser-4.0.2/junitparser.egg-info}/PKG-INFO +1 -1
- {junitparser-4.0.0 → junitparser-4.0.2}/LICENSE +0 -0
- {junitparser-4.0.0 → junitparser-4.0.2}/MANIFEST.in +0 -0
- {junitparser-4.0.0 → junitparser-4.0.2}/README.rst +0 -0
- {junitparser-4.0.0 → junitparser-4.0.2}/junitparser/__main__.py +0 -0
- {junitparser-4.0.0 → junitparser-4.0.2}/junitparser/cli.py +0 -0
- {junitparser-4.0.0 → junitparser-4.0.2}/junitparser/py.typed +0 -0
- {junitparser-4.0.0 → junitparser-4.0.2}/junitparser/xunit2.py +0 -0
- {junitparser-4.0.0 → junitparser-4.0.2}/junitparser.egg-info/SOURCES.txt +0 -0
- {junitparser-4.0.0 → junitparser-4.0.2}/junitparser.egg-info/dependency_links.txt +0 -0
- {junitparser-4.0.0 → junitparser-4.0.2}/junitparser.egg-info/entry_points.txt +0 -0
- {junitparser-4.0.0 → junitparser-4.0.2}/junitparser.egg-info/top_level.txt +0 -0
- {junitparser-4.0.0 → junitparser-4.0.2}/pyproject.toml +0 -0
- {junitparser-4.0.0 → junitparser-4.0.2}/setup.cfg +0 -0
- {junitparser-4.0.0 → junitparser-4.0.2}/tests/data/jenkins.xml +0 -0
- {junitparser-4.0.0 → junitparser-4.0.2}/tests/data/no_fails.xml +0 -0
- {junitparser-4.0.0 → junitparser-4.0.2}/tests/data/no_suites_tag.xml +0 -0
- {junitparser-4.0.0 → junitparser-4.0.2}/tests/data/normal.xml +0 -0
- {junitparser-4.0.0 → junitparser-4.0.2}/tests/data/pytest_error.xml +0 -0
- {junitparser-4.0.0 → junitparser-4.0.2}/tests/data/pytest_success.xml +0 -0
- {junitparser-4.0.0 → junitparser-4.0.2}/tests/test_cli.py +0 -0
- {junitparser-4.0.0 → junitparser-4.0.2}/tests/test_fromfile.py +0 -0
- {junitparser-4.0.0 → junitparser-4.0.2}/tests/test_general.py +0 -0
- {junitparser-4.0.0 → junitparser-4.0.2}/tests/test_write.py +0 -0
- {junitparser-4.0.0 → junitparser-4.0.2}/tests/test_xunit2.py +0 -0
|
@@ -11,6 +11,7 @@ See the documentation for other supported schemas.
|
|
|
11
11
|
import io
|
|
12
12
|
import itertools
|
|
13
13
|
from copy import deepcopy
|
|
14
|
+
from pathlib import Path
|
|
14
15
|
from typing import List, Union, Iterator, IO, Optional
|
|
15
16
|
|
|
16
17
|
try:
|
|
@@ -19,7 +20,7 @@ except ImportError:
|
|
|
19
20
|
from xml.etree import ElementTree as etree
|
|
20
21
|
|
|
21
22
|
|
|
22
|
-
def write_xml(obj, file_or_filename: Optional[Union[str, IO]] = None, *, pretty: bool = False):
|
|
23
|
+
def write_xml(obj, file_or_filename: Optional[Union[str, IO, Path]] = None, *, pretty: bool = False):
|
|
23
24
|
tree = etree.ElementTree(obj._elem)
|
|
24
25
|
if file_or_filename is None:
|
|
25
26
|
file_or_filename = obj.filepath
|
|
@@ -32,8 +33,11 @@ def write_xml(obj, file_or_filename: Optional[Union[str, IO]] = None, *, pretty:
|
|
|
32
33
|
text = etree.tostring(obj._elem)
|
|
33
34
|
xml = parseString(text) # nosec
|
|
34
35
|
content = xml.toprettyxml(encoding="utf-8")
|
|
36
|
+
if isinstance(file_or_filename, Path):
|
|
37
|
+
file_or_filename = str(file_or_filename)
|
|
38
|
+
|
|
35
39
|
if isinstance(file_or_filename, str):
|
|
36
|
-
with open(file_or_filename,
|
|
40
|
+
with open(file_or_filename, mode="wb") as xmlfile:
|
|
37
41
|
xmlfile.write(content)
|
|
38
42
|
else:
|
|
39
43
|
if isinstance(file_or_filename, io.TextIOWrapper):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|