-
-
Notifications
You must be signed in to change notification settings - Fork 611
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable Python warnings during tests and fix all in the code
When running the test suite with Python warnings enabled, several warnings are emitted. They look like: tests/test_utils.py::test_format_requirement /usr/lib64/python3.9/tempfile.py:817: ResourceWarning: Implicitly cleaning up <TemporaryDirectory '/tmp/tmpezxehep1source'> _warnings.warn(warn_message, ResourceWarning) To solve, make Repository.freshen_build_caches() a context manager. Upon entering the with statement, the build an source caches are created and upon exit they are cleaned up. This ensures they only live for the duration they are required. Tests were adjusted. tests/test_repository_pypi.py::test_pypirepo_build_dir_is_str .../pip/_vendor/requests/adapters.py:59: ResourceWarning: unclosed file <_io.FileIO name='/tmp/pytest-of-jon/pytest-70/test_open_local_or_remote_file5/foo.txt' mode='rb' closefd=True> super(BaseAdapter, self).__init__() To solve, test_open_local_or_remote_file_remote_file() was adjusted to close its file after use. tests/test_cli_compile.py::test_redacted_urls_in_verbose_output[--find-links] .../pip-tools/piptools/scripts/compile.py:306: FutureWarning: --index and --no-index are deprecated and will be removed in future versions. Use --emit-index-url/--no-emit-index-url instead. warnings.warn( To solve, use --no-emit-index-url in test_redacted_urls_in_verbose_output(). There remains one warning left, but this is out of the control of pip-tools. An upstream PR has been filed: pypa/pip#9156 Enabling the warnings in test runs will help catch them earlier and make debugging/fixing easier.
- Loading branch information
Showing
8 changed files
with
46 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters