Back to index

python3.2  3.2.2
Public Member Functions
test.test_warnings.WCmdLineTests Class Reference
Inheritance diagram for test.test_warnings.WCmdLineTests:
Inheritance graph

List of all members.

Public Member Functions

def test_improper_input
def test_improper_option
def test_warnings_bootstrap

Detailed Description

Definition at line 382 of file

Member Function Documentation

Definition at line 384 of file

00385     def test_improper_input(self):
00386         # Uses the private _setoption() function to test the parsing
00387         # of command-line warning arguments
00388         with original_warnings.catch_warnings(module=self.module):
00389             self.assertRaises(self.module._OptionError,
00390                               self.module._setoption, '1:2:3:4:5:6')
00391             self.assertRaises(self.module._OptionError,
00392                               self.module._setoption, 'bogus::Warning')
00393             self.assertRaises(self.module._OptionError,
00394                               self.module._setoption, 'ignore:2::4:-5')
00395             self.module._setoption('error::Warning::0')
00396             self.assertRaises(UserWarning, self.module.warn, 'convert to error')

Here is the call graph for this function:

Definition at line 397 of file

00398     def test_improper_option(self):
00399         # Same as above, but check that the message is printed out when
00400         # the interpreter is executed. This also checks that options are
00401         # actually parsed at all.
00402         rc, out, err = assert_python_ok("-Wxxx", "-c", "pass")
00403         self.assertIn(b"Invalid -W option ignored: invalid action: 'xxx'", err)

Here is the call graph for this function:

Definition at line 404 of file

00405     def test_warnings_bootstrap(self):
00406         # Check that the warnings module does get loaded when -W<some option>
00407         # is used (see issue #10372 for an example of silent bootstrap failure).
00408         rc, out, err = assert_python_ok("-Wi", "-c",
00409             "import sys; sys.modules['warnings'].warn('foo', RuntimeWarning)")
00410         # '-Wi' was observed
00411         self.assertFalse(out.strip())
00412         self.assertNotIn(b'RuntimeWarning', err)

Here is the call graph for this function:

The documentation for this class was generated from the following file: