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

--HG--
extra : rebase_source : bb19b261b10aeb9bb9a47a2d47fefc7604000430
This commit is contained in:
Bryce Van Dyk 2016-10-03 11:56:50 +13:00
Родитель 2d3b135ff8
Коммит 1d5b357b30
2 изменённых файлов: 8 добавлений и 6 удалений

Просмотреть файл

@ -405,9 +405,10 @@ class VideoPuppeteer(object):
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)

Просмотреть файл

@ -484,8 +484,9 @@ class YouTubePuppeteer(VideoPuppeteer):
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)