Bug 1307016 - Have puppeteer __str__ encode fields to ascii. r=maja_zf draft
authorBryce Van Dyk <bvandyk@mozilla.com>
Mon, 03 Oct 2016 11:56:50 +1300
changeset 421409 bb19b261b10aeb9bb9a47a2d47fefc7604000430
parent 419914 7c576fe3279d87543f0a03b844eba7bc215e17f1
child 533065 183bbaba5242f700cf4222a2b1bf66a47f89307c
push id31484
push userbvandyk@mozilla.com
push dateThu, 06 Oct 2016 01:34:49 +0000
reviewersmaja_zf
bugs1307016
milestone52.0a1
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
dom/media/test/external/external_media_tests/media_utils/video_puppeteer.py
dom/media/test/external/external_media_tests/media_utils/youtube_puppeteer.py
--- 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)