~ubuntu-branches/ubuntu/hardy/apport/hardy

« back to all changes in this revision

Viewing changes to apport/ui.py

  • Committer: Package Import Robot
  • Author(s): Martin Pitt, Martin Pitt, Sebastien Bacher
  • Date: 2008-04-01 16:02:46 UTC
  • Revision ID: package-import@ubuntu.com-20080401160246-up5vlb5a7l0kfhgi
Tags: 0.106
[ Martin Pitt ]
* apport/crashdb_impl/launchpad.py: Fix spelling mistake in p-lp-bugs API
  (now corrected there).
* apport_python_hook.py: Catch IndexError for invalid sys.argv[0], too.
  (LP: #204940)
* apport/ui.py: Add test_run_report_bug_unpackaged_pid() test case which
  reports a bug against a pid which belongs to an unpackaged program. This
  reproduces LP #203764.
* apport/report.py: Drop add_hooks_info() assertion on nonexisting Package
  field, return silently instead. This conforms to the behaviour of the
  other add_*_info() functions and avoids nasty error handling.
* apport/ui.py: Generate proper error message when calling with -f -p PID
  and PID belongs to an unpackaged program. (LP: #203764).

[ Sebastien Bacher ]
* po/Makevars: add the --language=python xgettext option so the translations
  template is correctly updated on build since cdbs is using intltool-update
  directly and not the corresponding makefile target

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
        report['Title'] = title
45
45
 
46
46
    # check package origin
47
 
    if not apport.packaging.is_distro_package(report['Package'].split()[0]):
 
47
    if 'Package' not in report or \
 
48
        not apport.packaging.is_distro_package(report['Package'].split()[0]):
48
49
        #TRANS: %s is the name of the operating system
49
50
        report['UnreportableReason'] = _('This is not a genuine %s package') % \
50
51
            report['DistroRelease'].split()[0]
1133
1134
 
1134
1135
            assert os.getuid() > 0, 'this test must not be run as root'
1135
1136
 
1136
 
            # silently ignore missing PID; this happens when the user closes
1137
 
            # the application prematurely
1138
1137
            sys.argv = ['ui-test', '-f', '-P', '1']
1139
1138
            self.ui = _TestSuiteUserInterface()
1140
1139
            self.ui.run_argv()
1141
1140
 
1142
1141
            self.assertEqual(self.ui.msg_severity, 'error')
1143
1142
 
 
1143
        def test_run_report_bug_unpackaged_pid(self):
 
1144
            '''Test run_report_bug() for a pid of an unpackaged program.'''
 
1145
 
 
1146
            # unpackaged test process
 
1147
            pid = os.fork()
 
1148
            if pid == 0:
 
1149
                sys.argv = ['/tmp/foo']
 
1150
                time.sleep(3600)
 
1151
                os._exit(0)
 
1152
 
 
1153
            try:
 
1154
                sys.argv = ['ui-test', '-f', '-P', str(pid)]
 
1155
                self.ui = _TestSuiteUserInterface()
 
1156
                self.assertRaises(SystemExit, self.ui.run_argv)
 
1157
            finally:
 
1158
                os.kill(pid, signal.SIGKILL)
 
1159
                os.wait()
 
1160
 
 
1161
            self.assertEqual(self.ui.msg_severity, 'error')
 
1162
 
1144
1163
        def _gen_test_crash(self):
1145
1164
            '''Generate a Report with real crash data.'''
1146
1165