aboutsummaryrefslogtreecommitdiffstats
path: root/tests/QtCore/qprocess_test.py
blob: 19d47f68a2e8923588bf54f2e77f624f6858c62d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/python
'''Test cases for QProcess'''

import unittest
import os

from PySide.QtCore import *

class TestQProcess (unittest.TestCase):
    def testStartDetached(self):
        value, pid = QProcess.startDetached("dir", [], os.getcwd())
        self.assert_(isinstance(value, bool))
        self.assert_(isinstance(pid, long))

    def testPid(self):
        p = QProcess()
        p.start("dir")
        p.waitForStarted()
        pid = p.pid()
        # We can't test the pid method result because it returns 0 when the
        # process isn't running
        if p.state() == QProcess.Running:
            self.assertNotEqual(pid, 0)
        else:
            print "PROCESS ALREADY DEAD :-/"

if __name__ == '__main__':
    unittest.main()