testWMI.py 458 B

1234567891011121314151617
  1. from win32com.client import GetObject
  2. import win32com.test.util
  3. import unittest
  4. class Simple(win32com.test.util.TestCase):
  5. def testit(self):
  6. cses = GetObject("WinMgMts:").InstancesOf("Win32_Process")
  7. vals = []
  8. for cs in cses:
  9. val = cs.Properties_("Caption").Value
  10. vals.append(val)
  11. self.failIf(len(vals)<5, "We only found %d processes!" % len(vals))
  12. if __name__=='__main__':
  13. unittest.main()