[Python-checkins] gh-103088: Fix test_venv error message to avoid bytes/str warning (GH-103500)

zooba webhook-mailer at python.org
Thu Apr 13 09:17:22 EDT 2023


https://github.com/python/cpython/commit/4307feaddc76b9e93cd38e325a1f0ee59d593093
commit: 4307feaddc76b9e93cd38e325a1f0ee59d593093
branch: main
author: Stanislav Syekirin <syekirin at gmail.com>
committer: zooba <steve.dower at microsoft.com>
date: 2023-04-13T14:17:14+01:00
summary:

gh-103088: Fix test_venv error message to avoid bytes/str warning (GH-103500)

files:
M Lib/test/test_venv.py

diff --git a/Lib/test/test_venv.py b/Lib/test/test_venv.py
index 23328431a7aa..7cccbe84f4eb 100644
--- a/Lib/test/test_venv.py
+++ b/Lib/test/test_venv.py
@@ -623,8 +623,9 @@ def test_activate_shell_script_has_no_dos_newlines(self):
         script_path = venv_dir / scripts_dir / "activate"
         venv.create(venv_dir)
         with open(script_path, 'rb') as script:
-            for line in script:
-                self.assertFalse(line.endswith(b'\r\n'), line)
+            for i, line in enumerate(script, 1):
+                error_message = f"CR LF found in line {i}"
+                self.assertFalse(line.endswith(b'\r\n'), error_message)
 
 @requireVenvCreate
 class EnsurePipTest(BaseTest):



More information about the Python-checkins mailing list