Skip to content

ResourceWarning in build log when running tests - unclosed file #1193

Open
@parthea

Description

@parthea

See the Kokoro build log which contains the following warning:

>               warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
E               pytest.PytestUnraisableExceptionWarning: Exception ignored in: <_io.FileIO [closed]>
E               
E               Traceback (most recent call last):
E                 File "/tmpfs/src/github/python-storage/.nox/unit-3-8/lib/python3.8/site-packages/mock/mock.py", line 2212, in _mock_set_magics
E                   setattr(_type, entry, MagicProxy(entry, self))
E               ResourceWarning: unclosed file <_io.FileIO name=12 mode='rb+' closefd=True>

If we treat warnings as errors the following tests fail:

FAILED tests/unit/test_transfer_manager.py::test_upload_many_passes_concurrency_options - pytest.PytestUnraisableExceptionWarning: Exception ignored in: <_io.FileIO [closed]>
FAILED tests/unit/test_transfer_manager.py::test_threads_deprecation_conflict_with_upload - pytest.PytestUnraisableExceptionWarning: Exception ignored in: <_io.FileIO [closed]>
FAILED tests/unit/test_transfer_manager.py::test_upload_many_with_processes_rejects_file_obj - pytest.PytestUnraisableExceptionWarning: Exception ignored in: <_io.FileIO [closed]>
FAILED tests/unit/test_transfer_manager.py::test_download_many_passes_concurrency_options - pytest.PytestUnraisableExceptionWarning: Exception ignored in: <_io.FileIO [closed]>
FAILED tests/unit/test_transfer_manager.py::test_download_many_with_processes_rejects_file_obj - pytest.PytestUnraisableExceptionWarning: Exception ignored in: <_io.FileIO [closed]>

Metadata

Metadata

Assignees

Labels

api: storageIssues related to the googleapis/python-storage API.type: cleanupAn internal cleanup or hygiene concern.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions