Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2b4d2dc

Browse files
committed
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.
1 parent 6b1adfd commit 2b4d2dc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/matplotlib/sphinxext/tests/test_tinypages.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ def plot_file(num):
8080
# Plot 13 shows close-figs in action
8181
assert_true(file_same(range_4, plot_file(13)))
8282
# Plot 14 has included source
83-
with open(pjoin(self.html_dir, 'some_plots.html'), 'rt') as fobj:
83+
with open(pjoin(self.html_dir, 'some_plots.html'), 'rb') as fobj:
8484
html_contents = fobj.read()
85-
assert_true('# Only a comment' in html_contents)
85+
assert_true(b'# Only a comment' in html_contents)
8686
# check plot defined in external file.
8787
assert_true(file_same(range_4, pjoin(self.html_dir, 'range4.png')))
8888
assert_true(file_same(range_6, pjoin(self.html_dir, 'range6.png')))
8989
# check if figure caption made it into html file
90-
assert_true('This is the caption for plot 15.' in html_contents)
90+
assert_true(b'This is the caption for plot 15.' in html_contents)

0 commit comments

Comments
 (0)