-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Under both Python 2 and Python 3, the output stream (actually always `sys.stdout` in practice) is opened in text mode, and so responsibility for handling the encoding lies with `.write`. The XUnit and YAML backends were previously explicitly forcing an encoding, which under Python 3 would mean `bytes` objects were generated. This makes `sys.stdout` remarkably unhappy. Solved by just removing the explicit encodings. Test case included.
- Loading branch information
Showing
3 changed files
with
24 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from unittest import TestCase | ||
from prospector.formatters import FORMATTERS | ||
from prospector.profiles.profile import ProspectorProfile | ||
import datetime | ||
|
||
|
||
class FormatterTypeTest(TestCase): | ||
def test_formatter_types(self): | ||
summary = {'started': datetime.datetime(2014, 1, 1), | ||
'completed': datetime.datetime(2014, 1, 1), | ||
'message_count': 0, | ||
'time_taken': '0', | ||
'libraries': [], | ||
'strictness': 'veryhigh', | ||
'profiles': '', | ||
'tools': []} | ||
profile = ProspectorProfile(name='horse', | ||
profile_dict={}, | ||
inherit_order=['horse']) | ||
for formatter_name, formatter in FORMATTERS.items(): | ||
with self.subTest(formatter=formatter_name): | ||
formatter_instance = formatter(summary, [], profile) | ||
self.assertIsInstance(formatter_instance.render(True, True, False), str) |