@@ -1569,11 +1569,12 @@ def setUp(self):
15691569 self .addCleanup (os_helper .unlink , self .tls_password_file )
15701570
15711571 def invoke_httpd (self , * args ):
1572- output = StringIO ()
1573- with contextlib .redirect_stdout (output ), \
1574- contextlib .redirect_stderr (output ):
1572+ stdout = StringIO ()
1573+ stderr = StringIO ()
1574+ with contextlib .redirect_stdout (stdout ), \
1575+ contextlib .redirect_stderr (stderr ):
15751576 server ._main (args )
1576- return output .getvalue ()
1577+ return { 'stdout' : stdout .getvalue (), 'stderr' : stderr . getvalue ()}
15771578
15781579 @mock .patch ('http.server.test' )
15791580 def test_port_flag (self , mock_func ):
@@ -1703,14 +1704,11 @@ def test_help_flag(self, _):
17031704 for option in options :
17041705 with self .assertRaises (SystemExit ):
17051706 output = self .invoke_httpd (option )
1706- self .assertStartsWith (output , 'usage: ' )
17071707
17081708 @mock .patch ('http.server.test' )
17091709 def test_unknown_flag (self , _ ):
17101710 with self .assertRaises (SystemExit ):
17111711 output = self .invoke_httpd ('--unknown-flag' )
1712- self .assertStartsWith (output , 'usage: ' )
1713-
17141712
17151713class CommandLineRunTimeTestCase (unittest .TestCase ):
17161714 random_data = os .urandom (1024 )
0 commit comments