Bug 1307016 - Have puppeteer __str__ encode fields to ascii. r=maja_zf
At least some of the environments the tests are running in do not appear to play
nice with non-ascii characters. Some of the jenkins runs are currently unhappy
due to this. This patch sees that all fields are encoded as ascii with
non-compatible characters replaced.
MozReview-Commit-ID: 6qSCyUujMLE
--- a/dom/media/test/external/external_media_tests/media_utils/video_puppeteer.py
+++ b/dom/media/test/external/external_media_tests/media_utils/video_puppeteer.py
@@ -400,19 +400,20 @@ class VideoPuppeteer(object):
'\t(video)'
]
messages += ['\tinterval: {}'.format(self.interval)]
messages += ['\texpected duration: {}'.format(self.expected_duration)]
messages += ['\tstall wait time: {}'.format(self.stall_wait_time)]
messages += ['\ttimeout: {}'.format(self.timeout)]
# Print each field on its own line
for field in self._last_seen_video_state._fields:
- messages += [('\t{}: {}'
- .format(field, getattr(self._last_seen_video_state,
- field)))]
+ # For compatibility with different test environments we force ascii
+ field_ascii = (str(getattr(self._last_seen_video_state, field))
+ .encode('ascii','replace'))
+ messages += [('\t{}: {}'.format(field, field_ascii))]
messages += '}'
return '\n'.join(messages)
class VideoException(Exception):
"""
Exception class to use for video-specific error processing.
"""
--- a/dom/media/test/external/external_media_tests/media_utils/youtube_puppeteer.py
+++ b/dom/media/test/external/external_media_tests/media_utils/youtube_puppeteer.py
@@ -479,13 +479,14 @@ class YouTubePuppeteer(VideoPuppeteer):
if not self.player:
messages += ['\t.html5-media-player: None']
return '\n'.join(messages)
if not self._last_seen_player_state:
messages += ['\t.html5-media-player: No last seen state']
return '\n'.join(messages)
messages += ['.html5-media-player: {']
for field in self._last_seen_player_state._fields:
- messages += [('\t{}: {}'
- .format(field, getattr(self._last_seen_player_state,
- field)))]
+ # For compatibility with different test environments we force ascii
+ field_ascii = (str(getattr(self._last_seen_video_state, field))
+ .encode('ascii', 'replace'))
+ messages += [('\t{}: {}'.format(field, field_ascii))]
messages += '}'
return '\n'.join(messages)