mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +00:00
[3.13] gh-121571: Do not use EnvironmentError
in tests, use OSError
instead (GH-121572) (#121574)
gh-121571: Do not use `EnvironmentError` in tests, use `OSError` instead (GH-121572)
(cherry picked from commit e2822360da
)
Co-authored-by: sobolevn <mail@sobolevn.me>
This commit is contained in:
parent
35c9399078
commit
ced3fe87b0
2 changed files with 2 additions and 2 deletions
|
@ -388,7 +388,7 @@ def skip_if_buildbot(reason=None):
|
||||||
reason = 'not suitable for buildbots'
|
reason = 'not suitable for buildbots'
|
||||||
try:
|
try:
|
||||||
isbuildbot = getpass.getuser().lower() == 'buildbot'
|
isbuildbot = getpass.getuser().lower() == 'buildbot'
|
||||||
except (KeyError, EnvironmentError) as err:
|
except (KeyError, OSError) as err:
|
||||||
warnings.warn(f'getpass.getuser() failed {err}.', RuntimeWarning)
|
warnings.warn(f'getpass.getuser() failed {err}.', RuntimeWarning)
|
||||||
isbuildbot = False
|
isbuildbot = False
|
||||||
return unittest.skipIf(isbuildbot, reason)
|
return unittest.skipIf(isbuildbot, reason)
|
||||||
|
|
|
@ -1407,7 +1407,7 @@ class ProcessTestCase(BaseTestCase):
|
||||||
t = threading.Thread(target=open_fds)
|
t = threading.Thread(target=open_fds)
|
||||||
t.start()
|
t.start()
|
||||||
try:
|
try:
|
||||||
with self.assertRaises(EnvironmentError):
|
with self.assertRaises(OSError):
|
||||||
subprocess.Popen(NONEXISTING_CMD,
|
subprocess.Popen(NONEXISTING_CMD,
|
||||||
stdin=subprocess.PIPE,
|
stdin=subprocess.PIPE,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue