def test_nonascii(self):
newenv = os.environ.copy()
newenv["PYTHONWARNINGS"] = "ignore:DeprecaciónWarning"
newenv["PYTHONIOENCODING"] = "utf-8"
p = subprocess.Popen([sys.executable,
"-c", "import sys; sys.stdout.write(str(sys.warnoptions))"],
stdout=subprocess.PIPE, env=newenv)
self.assertEqual(p.communicate()[0],
"['ignore:DeprecaciónWarning']".encode('utf-8'))
self.assertEqual(p.wait(), 0)
评论列表
文章目录