def test_comma_separated_warnings(self):
newenv = os.environ.copy()
newenv["PYTHONWARNINGS"] = ("ignore::DeprecationWarning,"
"ignore::UnicodeWarning")
p = subprocess.Popen([sys.executable,
"-c", "import sys; sys.stdout.write(str(sys.warnoptions))"],
stdout=subprocess.PIPE, env=newenv)
self.assertEqual(p.communicate()[0],
b"['ignore::DeprecationWarning', 'ignore::UnicodeWarning']")
self.assertEqual(p.wait(), 0)
评论列表
文章目录