test_platform: ignore DeprecationWarning on popen() test
This commit is contained in:
parent
46591664fa
commit
3a38a6db43
|
@ -1,8 +1,9 @@
|
||||||
import sys
|
|
||||||
import os
|
import os
|
||||||
import unittest
|
|
||||||
import platform
|
import platform
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import unittest
|
||||||
|
import warnings
|
||||||
|
|
||||||
from test import support
|
from test import support
|
||||||
|
|
||||||
|
@ -250,6 +251,8 @@ class PlatformTest(unittest.TestCase):
|
||||||
command = '"{}" -c "print(\'Hello\')"'.format(sys.executable)
|
command = '"{}" -c "print(\'Hello\')"'.format(sys.executable)
|
||||||
else:
|
else:
|
||||||
command = "'{}' -c 'print(\"Hello\")'".format(sys.executable)
|
command = "'{}' -c 'print(\"Hello\")'".format(sys.executable)
|
||||||
|
with warnings.catch_warnings():
|
||||||
|
warnings.simplefilter("ignore", DeprecationWarning)
|
||||||
with platform.popen(command) as stdout:
|
with platform.popen(command) as stdout:
|
||||||
hello = stdout.read().strip()
|
hello = stdout.read().strip()
|
||||||
stdout.close()
|
stdout.close()
|
||||||
|
@ -261,6 +264,8 @@ class PlatformTest(unittest.TestCase):
|
||||||
else:
|
else:
|
||||||
command = "'{}' -c 'import sys; data=sys.stdin.read(); exit(len(data))'"
|
command = "'{}' -c 'import sys; data=sys.stdin.read(); exit(len(data))'"
|
||||||
command = command.format(sys.executable)
|
command = command.format(sys.executable)
|
||||||
|
with warnings.catch_warnings():
|
||||||
|
warnings.simplefilter("ignore", DeprecationWarning)
|
||||||
with platform.popen(command, 'w') as stdin:
|
with platform.popen(command, 'w') as stdin:
|
||||||
stdout = stdin.write(data)
|
stdout = stdin.write(data)
|
||||||
ret = stdin.close()
|
ret = stdin.close()
|
||||||
|
|
Loading…
Reference in New Issue