[diffoscope] 01/02: tests: test_dos_mbr: explicitly use utf8 for reading files

Mattia Rizzolo mattia at debian.org
Thu Mar 8 12:27:12 CET 2018

This is an automated email from the git hooks/post-receive script.

mattia pushed a commit to branch master
in repository diffoscope.

commit aca61db5863bc2ba5cf507a4fb9687f2cbee9b41
Author: Mattia Rizzolo <mattia at debian.org>
Date:   Thu Mar 8 12:18:32 2018 +0100

    tests: test_dos_mbr: explicitly use utf8 for reading files
    Obviously, UnicodeDecodeErrors are right behind you.
    Gbp-Dch: Ignore
    Signed-off-by: Mattia Rizzolo <mattia at debian.org>
 tests/test_source.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/test_source.py b/tests/test_source.py
index 71f3b81..9b32c85 100644
--- a/tests/test_source.py
+++ b/tests/test_source.py
@@ -26,4 +26,5 @@ BASE_DIR = os.path.dirname(os.path.abspath(diffoscope.__file__))
 def test_dos_mbr():
     for x in glob.iglob(os.path.join(BASE_DIR, '**', '*.py'), recursive=True):
-        assert 'DOS/MBR' not in open(x).read()
+        with open(x, encoding='utf-8', errors='replace') as f:
+            assert 'DOS/MBR' not in f.read()

Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git

More information about the diffoscope mailing list