Back to index

python3.2  3.2.2
Public Member Functions | Static Public Attributes
test.test_warnings.CEnvironmentVariableTests Class Reference
Inheritance diagram for test.test_warnings.CEnvironmentVariableTests:
Inheritance graph
[legend]
Collaboration diagram for test.test_warnings.CEnvironmentVariableTests:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def test_single_warning
def test_comma_separated_warnings
def test_envvar_and_command_line
def test_nonascii
def setUp
def tearDown

Static Public Attributes

 module = c_warnings

Detailed Description

Definition at line 763 of file test_warnings.py.


Member Function Documentation

def test.test_warnings.BaseTest.setUp (   self) [inherited]

Definition at line 47 of file test_warnings.py.

00047 
00048     def setUp(self):
00049         # The __warningregistry__ needs to be in a pristine state for tests
00050         # to work properly.
00051         if '__warningregistry__' in globals():
00052             del globals()['__warningregistry__']
00053         if hasattr(warning_tests, '__warningregistry__'):
00054             del warning_tests.__warningregistry__
00055         if hasattr(sys, '__warningregistry__'):
00056             del sys.__warningregistry__
00057         # The 'warnings' module must be explicitly set so that the proper
00058         # interaction between _warnings and 'warnings' can be controlled.
00059         sys.modules['warnings'] = self.module
00060         super(BaseTest, self).setUp()

Here is the caller graph for this function:

def test.test_warnings.BaseTest.tearDown (   self) [inherited]

Definition at line 61 of file test_warnings.py.

00061 
00062     def tearDown(self):
00063         sys.modules['warnings'] = original_warnings
00064         super(BaseTest, self).tearDown()
00065 

Here is the caller graph for this function:

Definition at line 729 of file test_warnings.py.

00729 
00730     def test_comma_separated_warnings(self):
00731         newenv = os.environ.copy()
00732         newenv["PYTHONWARNINGS"] = ("ignore::DeprecationWarning,"
00733                                     "ignore::UnicodeWarning")
00734         p = subprocess.Popen([sys.executable,
00735                 "-c", "import sys; sys.stdout.write(str(sys.warnoptions))"],
00736                 stdout=subprocess.PIPE, env=newenv)
00737         self.assertEqual(p.communicate()[0],
00738                 b"['ignore::DeprecationWarning', 'ignore::UnicodeWarning']")
00739         self.assertEqual(p.wait(), 0)

Here is the call graph for this function:

Definition at line 740 of file test_warnings.py.

00740 
00741     def test_envvar_and_command_line(self):
00742         newenv = os.environ.copy()
00743         newenv["PYTHONWARNINGS"] = "ignore::DeprecationWarning"
00744         p = subprocess.Popen([sys.executable, "-W" "ignore::UnicodeWarning",
00745                 "-c", "import sys; sys.stdout.write(str(sys.warnoptions))"],
00746                 stdout=subprocess.PIPE, env=newenv)
00747         self.assertEqual(p.communicate()[0],
00748                 b"['ignore::UnicodeWarning', 'ignore::DeprecationWarning']")
00749         self.assertEqual(p.wait(), 0)

Here is the call graph for this function:

Definition at line 752 of file test_warnings.py.

00752 
00753     def test_nonascii(self):
00754         newenv = os.environ.copy()
00755         newenv["PYTHONWARNINGS"] = "ignore:Deprecaci├│nWarning"
00756         newenv["PYTHONIOENCODING"] = "utf-8"
00757         p = subprocess.Popen([sys.executable,
00758                 "-c", "import sys; sys.stdout.write(str(sys.warnoptions))"],
00759                 stdout=subprocess.PIPE, env=newenv)
00760         self.assertEqual(p.communicate()[0],
00761                 "['ignore:Deprecaci├│nWarning']".encode('utf-8'))
00762         self.assertEqual(p.wait(), 0)

Here is the call graph for this function:

Definition at line 720 of file test_warnings.py.

00720 
00721     def test_single_warning(self):
00722         newenv = os.environ.copy()
00723         newenv["PYTHONWARNINGS"] = "ignore::DeprecationWarning"
00724         p = subprocess.Popen([sys.executable,
00725                 "-c", "import sys; sys.stdout.write(str(sys.warnoptions))"],
00726                 stdout=subprocess.PIPE, env=newenv)
00727         self.assertEqual(p.communicate()[0], b"['ignore::DeprecationWarning']")
00728         self.assertEqual(p.wait(), 0)

Here is the call graph for this function:


Member Data Documentation

Definition at line 764 of file test_warnings.py.


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