~ubuntu-branches/ubuntu/utopic/apport/utopic

« back to all changes in this revision

Viewing changes to test/test_fileutils.py

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2012-07-09 08:14:30 UTC
  • mfrom: (148.1.66)
  • Revision ID: package-import@ubuntu.com-20120709081430-jim1xdcbior31pph
Tags: 2.3-0ubuntu1
* New upstream release:
  - launchpad.py: Rework test suite to not use Launchpad's +storeblob
    facility at all any more. It almost never works on staging and is
    horribly slow. Fake the bug creation from a blob by manually creating
    the comment and attachments ourselves, and just assume that storeblob
    works on production.  Also change the structure to allow running every
    test individually.
  - crash-digger: Add --crash-db option to specify a non-default crash
    database name. (LP: #1003506)
  - apport-gtk: Add --hanging option to specify the process ID of a hanging
    application. If the user chooses to report this error, apport will
    terminate the pid with SIGABRT, otherwise it will send SIGKILL. The
    normal core pipe handler will be used to process the resulting report
    file, with a .hanging file in /var/crash to separate these from regular
    crashes.
  - apport: Also treat a binary as modified if the /proc/pid/exe symlink
    does not point to an existing file any more. (LP: #984944)
  - Fix PEP-8 violations picked up by latest pep8 checker.
  - ui.py: Do not ignore certain exceptions during upload which are not
    likely to be a network error.
  - launchpad.py: Recongize Launchpad projects for bug query and marking
    operations. (LP: #1003506)
  - packaging-apt-dpkg.py: Fix get_source_tree() to work with apt sandboxes.
  - apport-retrace: Turn StacktraceSource generation back on, now that it
    works with the current sandboxing.
  - launchpad.py: Ensure that upload chunk size does not underrun.
    (LP: #1013334)
  - apport_python_hook: Fix UnicodeEncodeError crash with Python 2 for
    exceptions with non-ASCII characters. (LP: #972436)
  - test_ui_kde.py: Fix occasional test failure in test_1_crash_details if
    the application ends before the "is progress bar visible" check is done.

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
        # package without any .desktop file
47
47
        nodesktop = 'bash'
48
48
        assert len([f for f in apport.packaging.get_files(nodesktop)
49
 
            if f.endswith('.desktop')]) == 0
 
49
                    if f.endswith('.desktop')]) == 0
50
50
 
51
51
        # find a package with one and a package with multiple .desktop files
52
52
        onedesktop = None
57
57
            pkg = apport.packaging.get_file_package(
58
58
                os.path.join('/usr/share/applications/', d))
59
59
            num = len([f for f in apport.packaging.get_files(pkg)
60
 
                if f.endswith('.desktop')])
 
60
                       if f.endswith('.desktop')])
61
61
            if not onedesktop and num == 1:
62
62
                onedesktop = pkg
63
63
            elif not multidesktop and num > 1:
113
113
            self.assertEqual(apport.fileutils.seen_report(r), True)
114
114
            self.assertEqual(set(apport.fileutils.get_new_reports()), nr)
115
115
 
 
116
    def test_mark_hanging_process(self):
 
117
        '''mark_hanging_process()'''
 
118
        pr = problem_report.ProblemReport()
 
119
        pr['ExecutablePath'] = '/bin/bash'
 
120
        apport.fileutils.mark_hanging_process(pr, '1')
 
121
        uid = str(os.getuid())
 
122
        base = '_bin_bash.%s.1.hanging' % uid
 
123
        expected = os.path.join(apport.fileutils.report_dir, base)
 
124
        self.assertTrue(os.path.exists(expected))
 
125
 
 
126
    def test_mark_report_upload(self):
 
127
        '''mark_report_upload()'''
 
128
        report = os.path.join(apport.fileutils.report_dir, 'report.crash')
 
129
        apport.fileutils.mark_report_upload(report)
 
130
        expected = os.path.join(apport.fileutils.report_dir, 'report.upload')
 
131
        self.assertTrue(os.path.exists(expected))
 
132
 
116
133
    def test_get_all_reports(self):
117
134
        '''get_all_reports()'''
118
135