aboutsummaryrefslogtreecommitdiffstats
path: root/tests/QtCore/qprocess_test.py
blob: 96a6b793e1dabb40237318b388c9ad4db9dca18b (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
29
#!/usr/bin/python
'''Test cases for QProcess'''

import unittest
import os
import py3kcompat as py3k

from PySide.QtCore import *

class TestQProcess (unittest.TestCase):
    def testStartDetached(self):
        value, pid = QProcess.startDetached("dir", [], os.getcwd())
        self.assertTrue(isinstance(value, bool))
        self.assertTrue(isinstance(pid, py3k.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()