[Python-checkins] bpo-32248: Fix test_importlib.test_open() (#5213)

Victor Stinner webhook-mailer at python.org
Wed Jan 17 09:21:56 EST 2018


https://github.com/python/cpython/commit/3a0cf931796b9ad1b4833ab89c79d284b4253c91
commit: 3a0cf931796b9ad1b4833ab89c79d284b4253c91
branch: master
author: Victor Stinner <victor.stinner at gmail.com>
committer: GitHub <noreply at github.com>
date: 2018-01-17T15:21:50+01:00
summary:

bpo-32248: Fix test_importlib.test_open() (#5213)

Use the binary.file instead of utf-8.file to avoid issues with
Unix newlines vs Windows newlines.

files:
M Lib/test/test_importlib/test_open.py

diff --git a/Lib/test/test_importlib/test_open.py b/Lib/test/test_importlib/test_open.py
index ad236c61716..fd6e84b70f6 100644
--- a/Lib/test/test_importlib/test_open.py
+++ b/Lib/test/test_importlib/test_open.py
@@ -19,9 +19,9 @@ def execute(self, package, path):
 
 class OpenTests:
     def test_open_binary(self):
-        with resources.open_binary(self.data, 'utf-8.file') as fp:
+        with resources.open_binary(self.data, 'binary.file') as fp:
             result = fp.read()
-            self.assertEqual(result, b'Hello, UTF-8 world!\n')
+            self.assertEqual(result, b'\x00\x01\x02\x03')
 
     def test_open_text_default_encoding(self):
         with resources.open_text(self.data, 'utf-8.file') as fp:



More information about the Python-checkins mailing list