Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V1.9 fixes the problem with encoded str with non-ASCII (non-default-encoding) characters! #76

Open
wants to merge 3 commits into
base: v1.9
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,10 @@ Running the tests
pip install tox
tox

Releasing a new version
-----------------------

1. Bump version in `setup.py`
2. Build distribution with `python setup.py sdist bdist_wheel`
3. Upload to Pypi with `twine upload dist/*`
4. Verify the new version was uploaded at https://pypi.org/project/junit-xml/#history
5 changes: 3 additions & 2 deletions junit_xml/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,9 @@ def to_xml_report_file(file_descriptor, test_suites, prettyprint=True, encoding=
Writes the JUnit XML document to a file.
"""
xml_string = to_xml_report_string(test_suites, prettyprint=prettyprint, encoding=encoding)
# has problems with encoded str with non-ASCII (non-default-encoding) characters!
file_descriptor.write(xml_string)
# this fixes the problem with encoded str with non-ASCII (non-default-encoding) characters!
string_for_output = xml_string.encode('utf8', 'replace')
file_descriptor.write(string_for_output)


def _clean_illegal_xml_chars(string_to_clean):
Expand Down