From 9baf08f6af3287ab4acbef6b34c063a26881ecfd Mon Sep 17 00:00:00 2001 From: Steve Fink Date: Tue, 20 Apr 2021 14:36:57 +0000 Subject: [PATCH] Bug 1706115 - add encoding errors=... param to mozunit mocked open() r=ahal Differential Revision: https://phabricator.services.mozilla.com/D112622 --- config/mozunit/mozunit/mozunit.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/config/mozunit/mozunit/mozunit.py b/config/mozunit/mozunit/mozunit.py index bc327e47bb48..2d34484f6185 100644 --- a/config/mozunit/mozunit/mozunit.py +++ b/config/mozunit/mozunit/mozunit.py @@ -165,13 +165,20 @@ class _MockBaseOpen(object): self.open = open self.files = files - def __call__(self, name, mode="r", buffering=None, encoding=None, newline=None): + def __call__( + self, name, mode="r", buffering=None, encoding=None, newline=None, errors=None + ): # open() can be called with an integer "name" (i.e. a file descriptor). # We don't generally do this in our codebase, but internal Python # libraries sometimes do and we want to handle that cleanly. if isinstance(name, int): return self.open( - name, mode=mode, buffering=buffering, encoding=encoding, newline=newline + name, + mode=mode, + buffering=buffering, + encoding=encoding, + newline=newline, + errors=errors, ) # buffering is ignored. absname = normcase(os.path.abspath(name))