~aptdaemon-developers/aptdaemon/1.x

« back to all changes in this revision

Viewing changes to tests/test_debconf.py

  • Committer: Sebastian Heinlein
  • Date: 2012-12-29 23:41:16 UTC
  • mfrom: (883.1.26 pep8)
  • Revision ID: devel@glatzor.de-20121229234116-nd390n01ut2fcfce
PEP8 fixes and test for the test suite

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
from aptdaemon import test
16
16
from aptdaemon.debconf import DebconfProxy
17
17
 
18
 
DEBUG=False
 
18
DEBUG = False
19
19
 
20
20
 
21
21
class DebconfTestBasic(unittest.TestCase):
38
38
 
39
39
    def _spawn_config_script(self, config_db_path, command=None):
40
40
        if command is None:
41
 
            command=[os.path.join(test.get_tests_dir(),
42
 
                     "debconf/aptdaemon.config")]
 
41
            command = [os.path.join(test.get_tests_dir(),
 
42
                                    "debconf/aptdaemon.config")]
43
43
        env = {}
44
44
        env["DEBCONF_DB_REPLACE"] = "File{%s}" % config_db_path
45
45
        env["DEBIAN_FRONTEND"] = "passthrough"
54
54
    def testBasic(self):
55
55
        def config_done(pid, cond):
56
56
            self.assertEqual(cond, 0,
57
 
                              "Config script failed: %s" % os.WEXITSTATUS(cond))
 
57
                             "Config script failed: %s" % os.WEXITSTATUS(cond))
58
58
            self._stop()
59
 
        debconf_db_path = tempfile.mktemp(suffix=".dat", prefix="config-basic-")
 
59
        debconf_db_path = tempfile.mktemp(suffix=".dat",
 
60
                                          prefix="config-basic-")
60
61
        proc = self._spawn_config_script(debconf_db_path)
61
62
        GLib.child_watch_add(proc.pid, config_done)
62
63
        self.loop.run()
88
89
    def testRace(self):
89
90
        def config_done(pid, cond):
90
91
            self.assertEqual(cond, 0,
91
 
                              "Config script failed: %s" % os.WEXITSTATUS(cond))
 
92
                             "Config script failed: %s" % os.WEXITSTATUS(cond))
92
93
            self.workers -= 1
93
94
            if self.workers <= 0:
94
95
                self._stop()