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.
Files changed (28) hide show
  1. {junitparser-4.0.0/junitparser.egg-info → junitparser-4.0.2}/PKG-INFO +1 -1
  2. {junitparser-4.0.0 → junitparser-4.0.2}/junitparser/__init__.py +1 -1
  3. {junitparser-4.0.0 → junitparser-4.0.2}/junitparser/junitparser.py +6 -2
  4. {junitparser-4.0.0 → junitparser-4.0.2/junitparser.egg-info}/PKG-INFO +1 -1
  5. {junitparser-4.0.0 → junitparser-4.0.2}/LICENSE +0 -0
  6. {junitparser-4.0.0 → junitparser-4.0.2}/MANIFEST.in +0 -0
  7. {junitparser-4.0.0 → junitparser-4.0.2}/README.rst +0 -0
  8. {junitparser-4.0.0 → junitparser-4.0.2}/junitparser/__main__.py +0 -0
  9. {junitparser-4.0.0 → junitparser-4.0.2}/junitparser/cli.py +0 -0
  10. {junitparser-4.0.0 → junitparser-4.0.2}/junitparser/py.typed +0 -0
  11. {junitparser-4.0.0 → junitparser-4.0.2}/junitparser/xunit2.py +0 -0
  12. {junitparser-4.0.0 → junitparser-4.0.2}/junitparser.egg-info/SOURCES.txt +0 -0
  13. {junitparser-4.0.0 → junitparser-4.0.2}/junitparser.egg-info/dependency_links.txt +0 -0
  14. {junitparser-4.0.0 → junitparser-4.0.2}/junitparser.egg-info/entry_points.txt +0 -0
  15. {junitparser-4.0.0 → junitparser-4.0.2}/junitparser.egg-info/top_level.txt +0 -0
  16. {junitparser-4.0.0 → junitparser-4.0.2}/pyproject.toml +0 -0
  17. {junitparser-4.0.0 → junitparser-4.0.2}/setup.cfg +0 -0
  18. {junitparser-4.0.0 → junitparser-4.0.2}/tests/data/jenkins.xml +0 -0
  19. {junitparser-4.0.0 → junitparser-4.0.2}/tests/data/no_fails.xml +0 -0
  20. {junitparser-4.0.0 → junitparser-4.0.2}/tests/data/no_suites_tag.xml +0 -0
  21. {junitparser-4.0.0 → junitparser-4.0.2}/tests/data/normal.xml +0 -0
  22. {junitparser-4.0.0 → junitparser-4.0.2}/tests/data/pytest_error.xml +0 -0
  23. {junitparser-4.0.0 → junitparser-4.0.2}/tests/data/pytest_success.xml +0 -0
  24. {junitparser-4.0.0 → junitparser-4.0.2}/tests/test_cli.py +0 -0
  25. {junitparser-4.0.0 → junitparser-4.0.2}/tests/test_fromfile.py +0 -0
  26. {junitparser-4.0.0 → junitparser-4.0.2}/tests/test_general.py +0 -0
  27. {junitparser-4.0.0 → junitparser-4.0.2}/tests/test_write.py +0 -0
  28. {junitparser-4.0.0 → junitparser-4.0.2}/tests/test_xunit2.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: junitparser
3
- Version: 4.0.0
3
+ Version: 4.0.2
4
4
  Summary: Manipulates JUnit/xUnit Result XML files
5
5
  Author-email: Weiwei Wang <gastlygem@gmail.com>
6
6
  License: Apache-2.0
@@ -16,7 +16,7 @@ from .junitparser import (
16
16
  TestSuite,
17
17
  )
18
18
 
19
- version = "4.0.0"
19
+ version = "4.0.2"
20
20
 
21
21
  __all__ = [
22
22
  "Attr",
@@ -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, encoding="utf-8", mode="wb") as xmlfile:
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):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: junitparser
3
- Version: 4.0.0
3
+ Version: 4.0.2
4
4
  Summary: Manipulates JUnit/xUnit Result XML files
5
5
  Author-email: Weiwei Wang <gastlygem@gmail.com>
6
6
  License: Apache-2.0
File without changes
File without changes
File without changes
File without changes
File without changes