Skip to content

Commit 0d789f5

Browse files
add the test with '-S' and mismatched abi
1 parent 0acc59e commit 0d789f5

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Lib/test/test_traceback.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5275,9 +5275,17 @@ def test_incompatible_extension_modules_hint(self):
52755275
sys.path.insert(0, {tmp!r})
52765276
import foo
52775277
'''
5278-
_, _, stderr = assert_python_failure('-c', code, __cwd=tmp)
5278+
_, _, stderr1 = assert_python_failure('-c', code, __cwd=tmp)
5279+
# if used "-S", the message should contain two suggestions
5280+
_, _, stderr2 = assert_python_failure('-S', '-c', code, __cwd=tmp)
52795281
hint = f'Although a module with this name was found for a different Python version ({incompatible_module}).'
5280-
self.assertIn(hint, stderr.decode())
5282+
self.assertIn(hint, stderr1.decode())
5283+
self.assertIn(hint, stderr2.decode())
5284+
self.assertIn(
5285+
(b"Site initialization is disabled, did you forget to "
5286+
b"add the site-packages directory to sys.path "
5287+
b"or to enable your virtual environment?"), stderr2
5288+
)
52815289

52825290

52835291
class TestColorizedTraceback(unittest.TestCase):

0 commit comments

Comments
 (0)