summaryrefslogtreecommitdiff
path: root/test/_windows.py
diff options
context:
space:
mode:
authorFrank Benkstein <frank.benkstein@sap.com>2016-01-28 21:59:12 +0100
committerFrank Benkstein <frank.benkstein@sap.com>2016-02-01 14:13:59 +0100
commit6fe1544a7e2054c2eb16bf750b4a764e7fa87718 (patch)
tree81adb1eb5b2e8d626e80ad936b9124202e4fe2b8 /test/_windows.py
parent3924664725ab03c3ff114d776da0fcc3952e891d (diff)
downloadpsutil-revive-environ-windows.tar.gz
implement Process.environ() on Windowsrevive-environ-windows
Diffstat (limited to 'test/_windows.py')
-rw-r--r--test/_windows.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/_windows.py b/test/_windows.py
index f812880c..879a698c 100644
--- a/test/_windows.py
+++ b/test/_windows.py
@@ -526,6 +526,8 @@ class RemoteProcessTestCase(unittest.TestCase):
test_args = ["-c", "import sys; sys.stdin.read()"]
def setUp(self):
+ env = os.environ.copy()
+ env["THINK_OF_A_NUMBER"] = str(os.getpid())
self.proc32 = get_test_subprocess([self.python32] + self.test_args,
env=env,
stdin=subprocess.PIPE)
@@ -560,6 +562,18 @@ class RemoteProcessTestCase(unittest.TestCase):
p = psutil.Process(self.proc64.pid)
self.assertEqual(p.cwd(), os.getcwd())
+ def test_environ_32(self):
+ p = psutil.Process(self.proc32.pid)
+ e = p.environ()
+ self.assertIn("THINK_OF_A_NUMBER", e)
+ self.assertEquals(e["THINK_OF_A_NUMBER"], str(os.getpid()))
+
+ def test_environ_64(self):
+ p = psutil.Process(self.proc64.pid)
+ e = p.environ()
+ self.assertIn("THINK_OF_A_NUMBER", e)
+ self.assertEquals(e["THINK_OF_A_NUMBER"], str(os.getpid()))
+
def main():
test_suite = unittest.TestSuite()