Skip to content

Commit 6b0a123

Browse files
committed
gh-152297: Polish lazy import traceback tests
1 parent b6aeb52 commit 6b0a123

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Lib/test/test_traceback.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5610,7 +5610,7 @@ class TestLazyImportSuggestions(unittest.TestCase):
56105610
"""Test that lazy imports are not reified when computing AttributeError suggestions."""
56115611

56125612
@staticmethod
5613-
def lazy_holder_script(body):
5613+
def _lazy_holder_script(body):
56145614
setup = textwrap.dedent("""
56155615
import atexit
56165616
import os
@@ -5634,15 +5634,15 @@ def lazy_holder_script(body):
56345634

56355635
def test_attribute_error_does_not_reify_lazy_imports(self):
56365636
"""Printing an AttributeError should not trigger lazy import reification."""
5637-
code = self.lazy_holder_script("""
5637+
code = self._lazy_holder_script("""
56385638
lazy_holder.nonexistent
56395639
""")
56405640
rc, stdout, stderr = assert_python_failure('-c', code)
56415641
self.assertNotIn(b"BAR_MODULE_LOADED", stdout)
56425642

56435643
def test_traceback_formatting_does_not_reify_lazy_imports(self):
56445644
"""Formatting a traceback should not trigger lazy import reification."""
5645-
code = self.lazy_holder_script("""
5645+
code = self._lazy_holder_script("""
56465646
import traceback
56475647
try:
56485648
lazy_holder.nonexistent
@@ -5656,7 +5656,7 @@ def test_traceback_formatting_does_not_reify_lazy_imports(self):
56565656

56575657
def test_suggestion_still_works_for_non_lazy_attributes(self):
56585658
"""Suggestions should still work for non-lazy module attributes."""
5659-
code = self.lazy_holder_script("""
5659+
code = self._lazy_holder_script("""
56605660
lazy_holder.__nme__
56615661
""")
56625662
rc, stdout, stderr = assert_python_failure('-c', code)

0 commit comments

Comments
 (0)