fix(test): EncodingWarning: 'encoding' argument not specified - #3228
Merged
Conversation
gaborbernat
approved these changes
Sep 1, 2026
gaborbernat
enabled auto-merge (squash)
September 1, 2026 15:59
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thanks for contributing, make sure you address all the checklists (for details on how see development documentation)
tox -e fix)docs/changelogfolderHello
When running the tests, I see warnings.
`(virtualenv) ➜ virtualenv git:(main) tox -e py315
...
...
....................s............................................................................................ss...sss......................ss...... [ 41%]
s.....s....s....................s.....s...............s.s..s.......................................................................................s... [ 83%]
......................s............s........s............. [100%]
====================================================================== warnings summary =======================================================================
tests/unit/test_util.py::test_safe_delete_raises_the_original_error_not_a_retry_failure
/Users/vyuroshchin/github_my/virtualenv/tests/unit/test_util.py:64: EncodingWarning: 'encoding' argument not specified
(blocked / "wheel.py").write_text("cached")
tests/unit/test_util.py::test_safe_delete_keeps_the_other_mode_bits_when_clearing_read_only
/Users/vyuroshchin/github_my/virtualenv/tests/unit/test_util.py:79: EncodingWarning: 'encoding' argument not specified
blocked.write_text("cached")
tests/unit/seed/embed/test_bootstrap_link_via_app_data.py::test_safe_extract_zip_allows_normal_entry
/Users/vyuroshchin/github_my/virtualenv/tests/unit/seed/embed/test_bootstrap_link_via_app_data.py:272: EncodingWarning: 'encoding' argument not specified
assert (target / "pkg" / "inner.txt").read_text() == "payload"
tests/unit/test_util.py::test_safe_delete_removes_read_only_files
/Users/vyuroshchin/github_my/virtualenv/tests/unit/test_util.py:36: EncodingWarning: 'encoding' argument not specified
marked.write_text("cached")
tests/unit/test_util.py::TestCacheDirMigration::test_migrate_old_to_new
/Users/vyuroshchin/github_my/virtualenv/tests/unit/test_util.py:128: EncodingWarning: 'encoding' argument not specified
(tmp_path / "old-data" / "test.txt").write_text("hello")
tests/unit/test_util.py::TestCacheDirMigration::test_migrate_old_to_new
/Users/vyuroshchin/github_my/virtualenv/tests/unit/test_util.py:137: EncodingWarning: 'encoding' argument not specified
assert (tmp_path / "new-cache" / "test.txt").read_text() == "hello"
tests/unit/test_util.py::TestCacheDirMigration::test_symlink_app_data_survives_migration[False]
tests/unit/test_util.py::TestCacheDirMigration::test_symlink_app_data_survives_migration[True]
/Users/vyuroshchin/github_my/virtualenv/tests/unit/test_util.py:202: EncodingWarning: 'encoding' argument not specified
(wheel_img / "pip.dist-info" / "METADATA").write_text("Name: pip")
tests/unit/test_util.py::TestCacheDirMigration::test_no_migration_when_new_exists
/Users/vyuroshchin/github_my/virtualenv/tests/unit/test_util.py:155: EncodingWarning: 'encoding' argument not specified
(tmp_path / "old-data" / "old.txt").write_text("old")
tests/unit/activation/test_bash.py::test_bash_activate_relocation_resolves_virtual_env
/Users/vyuroshchin/github_my/virtualenv/tests/unit/activation/test_bash.py:96: EncodingWarning: 'encoding' argument not specified.
result = subprocess.run(
tests/unit/create/test_creator.py::test_pyenv_cfg_preserves_symlinks
/Users/vyuroshchin/github_my/virtualenv/tests/unit/create/test_creator.py:827: EncodingWarning: 'encoding' argument not specified
real_file.write_text("test")
tests/unit/create/test_creator.py::test_pyenv_cfg_preserves_symlinks
/Users/vyuroshchin/github_my/virtualenv/tests/unit/create/test_creator.py:842: EncodingWarning: 'encoding' argument not specified
written_content = cfg_path.read_text()
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
-------------------------------------- generated xml file: /Users/vyuroshchin/github_my/virtualenv/.tox/junit.py315.xml ---------------------------------------
======================================================== 340 passed, 20 skipped, 12 warnings in 46.79s ========================================================
`
In PR I fixed this warnings like https://github.com/python-poetry/poetry/pull/8893/changes#diff-a1176a239bb3b9e9eb632f8f1090097a3630cea9f405da6b0506642e5343dd07R921 (add param encoding="utf-8" in tests)