From 2b4d2dcee8467219af5a492fc97a858f0552356e Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Fri, 17 Jun 2016 23:50:40 -0700 Subject: [PATCH] BF: protect against locale in sphinext text The sphinxext tests were loading a text file with encoding not stated, making the test sensitive to the default locale of the testing machine. See: https://travis-ci.org/matthew-brett/matplotlib-wheels/jobs/138518917#L8787 Read the text file as binary to avoid need for encoding. --- lib/matplotlib/sphinxext/tests/test_tinypages.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/sphinxext/tests/test_tinypages.py b/lib/matplotlib/sphinxext/tests/test_tinypages.py index 1b1834f478cc..ae464a6c12e2 100644 --- a/lib/matplotlib/sphinxext/tests/test_tinypages.py +++ b/lib/matplotlib/sphinxext/tests/test_tinypages.py @@ -80,11 +80,11 @@ def plot_file(num): # Plot 13 shows close-figs in action assert_true(file_same(range_4, plot_file(13))) # Plot 14 has included source - with open(pjoin(self.html_dir, 'some_plots.html'), 'rt') as fobj: + with open(pjoin(self.html_dir, 'some_plots.html'), 'rb') as fobj: html_contents = fobj.read() - assert_true('# Only a comment' in html_contents) + assert_true(b'# Only a comment' in html_contents) # check plot defined in external file. assert_true(file_same(range_4, pjoin(self.html_dir, 'range4.png'))) assert_true(file_same(range_6, pjoin(self.html_dir, 'range6.png'))) # check if figure caption made it into html file - assert_true('This is the caption for plot 15.' in html_contents) + assert_true(b'This is the caption for plot 15.' in html_contents)