~ps-jenkins/ubuntu-system-image/ubuntu-utopic-proposed

« back to all changes in this revision

Viewing changes to systemimage/testing/nose.py

  • Committer: CI bot
  • Date: 2014-09-17 17:56:35 UTC
  • mfrom: (236.1.3 citrain-24.0u1)
  • Revision ID: ps-jenkins@lists.canonical.com-20140917175635-vinboezbdhcojvh9
* New upstream release.
  - LP: #1353178 - The channel.ini file can override the device name by
    setting `[service]device`.
  - LP: #1324241 - Add optional instrumentation to collect code coverage
    data during test suite run via tox.
  - LP: #1279970 - When an exception occurs in a `system-image-dbus`
    D-Bus method, signal, or callback, this exception is logged in the
    standard log file, and the process exits.  Also, `[system]loglevel`
    can now take an optional ":level" prefix which can be used to set
    the log level for the D-Bus API methods.  By default, they log at
    `ERROR` level, but can be set lower for debugging purposes.
  - LP: #1365646 - Don't crash when releasing an unacquired checking lock.
  - LP: #1365761 - When checking files for `last_update_date()` ignore
    PermissionErrors and just keep checking the fall backs.
  - LP: #1369714 - `system-image-cli --dbus` has been deprecated and
    will be removed in the future.
* d/control: Remove tox as a build dependency to avoid having to MIR tox,
  virtualenv, and pip.
* d/rules:
  - Call nose2 explicitly to avoid use of tox.
  - Remove unnecessary override_dh_auto_clean rule.
* d/system-image-common.post{inst,rm}: `set -e` to make lintian happy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
import re
24
24
import atexit
 
25
import logging
25
26
 
26
27
from dbus.mainloop.glib import DBusGMainLoop
27
28
from nose2.events import Plugin
 
29
from systemimage.config import config
28
30
from systemimage.logging import initialize
29
31
from systemimage.testing.controller import Controller
30
32
from systemimage.testing.helpers import configuration
76
78
        self.patterns = []
77
79
        self.verbosity = 0
78
80
        self.log_file = None
 
81
        self.log_level = 'info'
79
82
        self.addArgument(self.patterns, 'P', 'pattern',
80
83
                         'Add a test matching pattern')
81
84
        def bump(ignore):
82
85
            self.verbosity += 1
83
 
        self.addFlag(bump, 'V', 'Verbosity',
 
86
        self.addFlag(bump, 'V', 'verbosity',
84
87
                     'Increase system-image verbosity')
85
88
        def set_log_file(path):
86
89
            self.log_file = path[0]
87
90
        self.addOption(set_log_file, 'L', 'logfile',
88
91
                       'Set the log file for the test run',
89
92
                       nargs=1)
 
93
        def set_dbus_loglevel(level):
 
94
            self.log_level = 'info:{}'.format(level[0])
 
95
        self.addOption(set_dbus_loglevel, 'M', 'loglevel',
 
96
                       'Set the systemimage.dbus log level',
 
97
                       nargs=1)
90
98
 
91
99
    @configuration
92
100
    def startTestRun(self, event):
93
 
        from systemimage.config import config
94
101
        if self.log_file is not None:
95
102
            config.system.logfile = self.log_file
96
103
        DBusGMainLoop(set_as_default=True)
101
108
        # individual services, and we can write new dbus configuration files
102
109
        # and HUP the dbus-launch to re-read them, but we cannot change bus
103
110
        # addresses after the initial one is set.
104
 
        SystemImagePlugin.controller = Controller(self.log_file)
 
111
        SystemImagePlugin.controller = Controller(
 
112
            self.log_file, self.log_level)
105
113
        SystemImagePlugin.controller.start()
106
114
        atexit.register(SystemImagePlugin.controller.stop)
107
115