mirror of https://github.com/python/cpython
gh-121571: Do not use `EnvironmentError` in tests, use `OSError` instead (#121572)
This commit is contained in:
parent
22a0bdbf9a
commit
e2822360da
|
@ -387,7 +387,7 @@ def skip_if_buildbot(reason=None):
|
|||
reason = 'not suitable for buildbots'
|
||||
try:
|
||||
isbuildbot = getpass.getuser().lower() == 'buildbot'
|
||||
except (KeyError, EnvironmentError) as err:
|
||||
except (KeyError, OSError) as err:
|
||||
warnings.warn(f'getpass.getuser() failed {err}.', RuntimeWarning)
|
||||
isbuildbot = False
|
||||
return unittest.skipIf(isbuildbot, reason)
|
||||
|
|
|
@ -1407,7 +1407,7 @@ class ProcessTestCase(BaseTestCase):
|
|||
t = threading.Thread(target=open_fds)
|
||||
t.start()
|
||||
try:
|
||||
with self.assertRaises(EnvironmentError):
|
||||
with self.assertRaises(OSError):
|
||||
subprocess.Popen(NONEXISTING_CMD,
|
||||
stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE,
|
||||
|
|
Loading…
Reference in New Issue