We've got some code that does
with mock.patch('sys.getfilesystemencoding', return_value='koi8_r'): ... calls something that calls sys.getfilesystemencoding
When this is run with coverage, it says
File "/opt/stack/oslo.utils/.tox/cover/local/lib/python2.7/site-packages/coverage/files.py", line 137, in unicode_filename filename = filename.decode(encoding, "replace") LookupError: unknown encoding: koi8_r
If you want to recreate, get the oslo.utils code ( https://git.openstack.org/openstack/oslo.utils ) and run tox -e cover on it.
I haven't been able to figure out a way to work around this. It might help if coverage didn't try to convert the name again since the function was used before so it should have seen the filename for the function in this same test.