gh-108638: Fix tests when _stat extension is missing (#108689)

Fix test_inspect and test_pydoc when the _stat extension is missing.
Skip tests relying on _stat when _stat is missing.
This commit is contained in:
Victor Stinner 2023-08-31 23:14:23 +02:00 committed by GitHub
parent d48760b2f1
commit c6d56135e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 7 deletions

View file

@ -1187,7 +1187,13 @@ def test_module_level_callable_noargs(self):
"time()")
def test_module_level_callable_o(self):
self.assertEqual(self._get_summary_line(stat.S_IMODE),
try:
import _stat
except ImportError:
# stat.S_IMODE() and _stat.S_IMODE() have a different signature
self.skipTest('_stat extension is missing')
self.assertEqual(self._get_summary_line(_stat.S_IMODE),
"S_IMODE(object, /)")
def test_unbound_builtin_method_noargs(self):