示例#1
0
    def getReporter(self,
                    ppa_owner=None,
                    gen_over_quota=False,
                    gen_user_emails=False,
                    gen_orphan_repos=False,
                    gen_missing_repos=False,
                    output=None,
                    quota_threshold=None):
        """Return a `PPAReportScript` instance.

        When the 'output' command-line options is not set it overrides the
        script setup to store output in a `StringIO` object so it can be
        verified later.
        """
        test_args = []

        if ppa_owner is not None:
            test_args.extend(['-p', ppa_owner])

        if output is not None:
            test_args.extend(['-o', output])

        if quota_threshold is not None:
            test_args.extend(['-t', quota_threshold])

        if gen_over_quota:
            test_args.append('--gen-over-quota')

        if gen_user_emails:
            test_args.append('--gen-user-emails')

        if gen_orphan_repos:
            test_args.append('--gen-orphan-repos')

        if gen_missing_repos:
            test_args.append('--gen-missing-repos')

        reporter = PPAReportScript(name='ppa-report', test_args=test_args)
        reporter.logger = BufferLogger()

        # Override the output handlers if no 'output' option was passed
        # via command-line.
        if output is None:

            def set_test_output():
                reporter.output = StringIO()

            reporter.setOutput = set_test_output

            reporter.closeOutput = FakeMethod()

        return reporter
    def getReporter(self, ppa_owner=None, gen_over_quota=False,
                    gen_user_emails=False, gen_orphan_repos=False,
                    gen_missing_repos=False, output=None,
                    quota_threshold=None):
        """Return a `PPAReportScript` instance.

        When the 'output' command-line options is not set it overrides the
        script setup to store output in a `StringIO` object so it can be
        verified later.
        """
        test_args = []

        if ppa_owner is not None:
            test_args.extend(['-p', ppa_owner])

        if output is not None:
            test_args.extend(['-o', output])

        if quota_threshold is not None:
            test_args.extend(['-t', quota_threshold])

        if gen_over_quota:
            test_args.append('--gen-over-quota')

        if gen_user_emails:
            test_args.append('--gen-user-emails')

        if gen_orphan_repos:
            test_args.append('--gen-orphan-repos')

        if gen_missing_repos:
            test_args.append('--gen-missing-repos')

        reporter = PPAReportScript(name='ppa-report', test_args=test_args)
        reporter.logger = BufferLogger()

        # Override the output handlers if no 'output' option was passed
        # via command-line.
        if output is None:

            def set_test_output():
                reporter.output = StringIO()
            reporter.setOutput = set_test_output

            reporter.closeOutput = FakeMethod()

        return reporter
示例#3
0
#!/usr/bin/python -S
#
# Copyright 2009 Canonical Ltd.  This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).

import _pythonpath

from lp.soyuz.scripts.ppareport import PPAReportScript


if __name__ == '__main__':
    script = PPAReportScript('ppareport', dbuser='******')
    script.run()
示例#4
0
#!/usr/bin/python -S
#
# Copyright 2009 Canonical Ltd.  This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).

import _pythonpath

from lp.soyuz.scripts.ppareport import PPAReportScript

if __name__ == '__main__':
    script = PPAReportScript('ppareport', dbuser='******')
    script.run()