summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_os.py
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2010-09-07 21:31:17 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2010-09-07 21:31:17 (GMT)
commit4b6fdf38525382dc279c5b32023f931e6db98591 (patch)
tree155ef27daaa49e0f2026d68e208d903b3e0d8a99 /Lib/test/test_os.py
parent8bc09039ed7a2aa9d878e82419baf3402c48600d (diff)
downloadcpython-4b6fdf38525382dc279c5b32023f931e6db98591.zip
cpython-4b6fdf38525382dc279c5b32023f931e6db98591.tar.gz
cpython-4b6fdf38525382dc279c5b32023f931e6db98591.tar.bz2
#6394: Add os.getppid() support for Windows.
Diffstat (limited to 'Lib/test/test_os.py')
-rw-r--r--Lib/test/test_os.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index 6ce0d5f..f42290f 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -1183,6 +1183,17 @@ class FSEncodingTests(unittest.TestCase):
check('iso-8859-15', b'\xef\xa4', '\xef\u20ac')
+class PidTests(unittest.TestCase):
+ @unittest.skipUnless(hasattr(os, 'getppid'), "test needs os.getppid")
+ def test_getppid(self):
+ p = subprocess.Popen([sys.executable, '-c',
+ 'import os; print(os.getppid())'],
+ stdout=subprocess.PIPE)
+ stdout, _ = p.communicate()
+ # We are the parent of our subprocess
+ self.assertEqual(int(stdout), os.getpid())
+
+
def test_main():
support.run_unittest(
FileTests,
@@ -1200,6 +1211,7 @@ def test_main():
Win32KillTests,
Win32SymlinkTests,
FSEncodingTests,
+ PidTests,
)
if __name__ == "__main__":