Skip to content

Commit

Permalink
Merge a758462 into de082ea
Browse files Browse the repository at this point in the history
  • Loading branch information
jsfehler committed Jun 17, 2018
2 parents de082ea + a758462 commit 216eeb2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
=========

1.9.1
-----

- Fix utf-8 decode warnings when taking screenshots with pytest-xdist active `#108 <https://github.com/pytest-dev/pytest-splinter/issues/108>`_ (jsfehler)


1.9.0
-----

Expand Down
4 changes: 2 additions & 2 deletions pytest_splinter/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ def _take_screenshot(
reprtraceback.extraline = _screenshot_extraline(screenshot_png_path, screenshot_html_path)
if slaveoutput is not None:
with codecs.open(screenshot_html_path, encoding=splinter_screenshot_encoding) as html_fd:
with open(screenshot_png_path) as fd:
with open(screenshot_png_path, 'rb') as fd:
slaveoutput.setdefault('screenshots', []).append({
'class_name': classname,
'files': [
Expand Down Expand Up @@ -623,7 +623,7 @@ def pytest_testnodedown(self, node, error):
os.makedirs(screenshot_dir)
for fil in screenshot['files']:
encoding = fil.get('encoding')
with codecs.open(os.path.join(screenshot_dir, fil['file_name']), 'w',
with codecs.open(os.path.join(screenshot_dir, fil['file_name']), 'wb',
**dict(encoding=encoding) if encoding else {}) as fd:
fd.write(fil['content'])

Expand Down

0 comments on commit 216eeb2

Please sign in to comment.