]> granicus.if.org Git - python/commitdiff
test_regrtest: catch stderr in test_nowindows()
authorVictor Stinner <victor.stinner@gmail.com>
Sun, 11 Oct 2015 08:04:26 +0000 (10:04 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Sun, 11 Oct 2015 08:04:26 +0000 (10:04 +0200)
Check also that the deprecation warning is emited.

Lib/test/test_regrtest.py

index 0f0069836bab61e0362e80e8a6cfcb1bd11cc054..16a29b1c9a0586377c057cbcf1633d5595695418 100644 (file)
@@ -5,6 +5,7 @@ Note: test_regrtest cannot be run twice in parallel.
 """
 
 import argparse
+import contextlib
 import faulthandler
 import getopt
 import io
@@ -247,8 +248,11 @@ class ParseArgsTestCase(unittest.TestCase):
     def test_nowindows(self):
         for opt in '-n', '--nowindows':
             with self.subTest(opt=opt):
-                ns = libregrtest._parse_args([opt])
+                with contextlib.redirect_stderr(io.StringIO()) as stderr:
+                    ns = libregrtest._parse_args([opt])
                 self.assertTrue(ns.nowindows)
+                err = stderr.getvalue()
+                self.assertIn('the --nowindows (-n) option is deprecated', err)
 
     def test_forever(self):
         for opt in '-F', '--forever':