python / importlib_resources

Backport of the importlib.resources module
Apache License 2.0
64 stars 44 forks source link

Missed EncodingWarning #280

Closed jaraco closed 1 year ago

jaraco commented 1 year ago

In v5.10.3, I addressed what I thought was all of the encoding warnings emitted by this test suite.

However, due to the way the warnings framework attempts to localize the usage, there was one warning (with two invocations) that I'd missed:

importlib_resources/tests/test_open.py::OpenDiskTests::test_open_text_FileNotFoundError
importlib_resources/tests/test_open.py::OpenDiskNamespaceTests::test_open_text_FileNotFoundError
  /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/unittest/case.py:237: EncodingWarning: 'encoding' argument not specified
    callable_obj(*args, **kwargs)

That warning looks like it's coming from unittest.case:237, but when I looked at that code, I can see that it's just the wrapper created by use of assertRaises. Fortunately, the test names give some hint as to where the missed encoding parameter is (test_open_text_FileNotfoundError).