mirror of https://github.com/python/cpython
test_regrtest: catch stderr in test_nowindows()
Check also that the deprecation warning is emited.
This commit is contained in:
parent
4967146c8d
commit
14b4662e18
|
@ -5,6 +5,7 @@ Note: test_regrtest cannot be run twice in parallel.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import contextlib
|
||||||
import faulthandler
|
import faulthandler
|
||||||
import getopt
|
import getopt
|
||||||
import io
|
import io
|
||||||
|
@ -247,8 +248,11 @@ class ParseArgsTestCase(unittest.TestCase):
|
||||||
def test_nowindows(self):
|
def test_nowindows(self):
|
||||||
for opt in '-n', '--nowindows':
|
for opt in '-n', '--nowindows':
|
||||||
with self.subTest(opt=opt):
|
with self.subTest(opt=opt):
|
||||||
|
with contextlib.redirect_stderr(io.StringIO()) as stderr:
|
||||||
ns = libregrtest._parse_args([opt])
|
ns = libregrtest._parse_args([opt])
|
||||||
self.assertTrue(ns.nowindows)
|
self.assertTrue(ns.nowindows)
|
||||||
|
err = stderr.getvalue()
|
||||||
|
self.assertIn('the --nowindows (-n) option is deprecated', err)
|
||||||
|
|
||||||
def test_forever(self):
|
def test_forever(self):
|
||||||
for opt in '-F', '--forever':
|
for opt in '-F', '--forever':
|
||||||
|
|
Loading…
Reference in New Issue