Skip to content

Commit 9142f49

Browse files
authored
Merge pull request #109 from jsfehler/master
Read and write binary for screenshots
2 parents de082ea + a758462 commit 9142f49

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

CHANGES.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Changelog
22
=========
33

4+
1.9.1
5+
-----
6+
7+
- Fix utf-8 decode warnings when taking screenshots with pytest-xdist active `#108 <https://github.com/pytest-dev/pytest-splinter/issues/108>`_ (jsfehler)
8+
9+
410
1.9.0
511
-----
612

pytest_splinter/plugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ def _take_screenshot(
401401
reprtraceback.extraline = _screenshot_extraline(screenshot_png_path, screenshot_html_path)
402402
if slaveoutput is not None:
403403
with codecs.open(screenshot_html_path, encoding=splinter_screenshot_encoding) as html_fd:
404-
with open(screenshot_png_path) as fd:
404+
with open(screenshot_png_path, 'rb') as fd:
405405
slaveoutput.setdefault('screenshots', []).append({
406406
'class_name': classname,
407407
'files': [
@@ -623,7 +623,7 @@ def pytest_testnodedown(self, node, error):
623623
os.makedirs(screenshot_dir)
624624
for fil in screenshot['files']:
625625
encoding = fil.get('encoding')
626-
with codecs.open(os.path.join(screenshot_dir, fil['file_name']), 'w',
626+
with codecs.open(os.path.join(screenshot_dir, fil['file_name']), 'wb',
627627
**dict(encoding=encoding) if encoding else {}) as fd:
628628
fd.write(fil['content'])
629629

0 commit comments

Comments
 (0)