~ubuntu-branches/ubuntu/quantal/virtinst/quantal-updates

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-07-24 08:52:01 UTC
  • mfrom: (1.6.8 sid)
  • Revision ID: package-import@ubuntu.com-20120724085201-q3h0cbabg4t46gfm
Tags: 0.600.2-1ubuntu1
* Merge from debian unstable. Remaining changes:
  - debian/patches/9003-fix-path-to-hvmloader-in-testsuite.patch: adjust
    testsuite for 0001-fix-path-to-hvmloader.patch and
    0002-Fix-path-to-pygrub.patch.
  - debian/patches/9004_ubuntu_fix_tree_support.patch: Fix tree detection
    for all ISO/HTTP source, to not longer fail with cobbler/koan.
  - debian/patches/0004-Fix-path-to-qemu-dm.patch: fix the path to the
    qemu-dm binary.
  - debian/{control,rules,pyversions}: Build using dh_python2, use
    debhelper v8 instead of cdbs; for some reason the package build an
    empty binary package when using dh_python2.
  - debian/control: added acl package to depends.
  - debian/control: added libvirt-bin to recommends
* Dropped patches:
  - debian/patches/9005_ubuntu_releases.patch: Upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
from distutils.command.build import build
24
24
from unittest import TextTestRunner, TestLoader
25
25
 
26
 
VERSION = "0.600.1"
 
26
VERSION = "0.600.2"
27
27
 
28
28
# translation installing
29
29
def _build_po_list():
68
68
 
69
69
    def run(self):
70
70
        try:
 
71
            # Use system 'coverage' if available
71
72
            import coverage
72
73
            use_coverage = True
73
74
        except:
74
 
            # Use system 'coverage' if available
75
75
            use_coverage = False
76
76
 
77
77
        tests = TestLoader().loadTestsFromNames(self._testfiles)
86
86
        if use_coverage:
87
87
            coverage.stop()
88
88
 
89
 
        if len(result.failures) > 0 or len(result.errors) > 0:
90
 
            sys.exit(1)
91
 
        else:
92
 
            sys.exit(0)
 
89
        sys.exit(int(bool(len(result.failures) > 0 or
 
90
                          len(result.errors) > 0)))
93
91
 
94
92
class TestCommand(TestBaseCommand):
95
93
 
96
94
    description = "Runs a quick unit test suite"
97
95
    user_options = TestBaseCommand.user_options + \
98
96
                   [("testfile=", None, "Specific test file to run (e.g "
99
 
                                        "validation, storage, ...)")]
 
97
                                        "validation, storage, ...)"),
 
98
                    ("skipcli", None, "Skip CLI tests")]
100
99
 
101
100
    def initialize_options(self):
102
101
        TestBaseCommand.initialize_options(self)
103
102
        self.testfile = None
 
103
        self.skipcli = None
104
104
 
105
105
    def finalize_options(self):
106
106
        TestBaseCommand.finalize_options(self)
111
111
        '''
112
112
        testfiles = []
113
113
        for t in glob.glob(os.path.join(self._dir, 'tests', '*.py')):
114
 
            if (t.endswith('__init__.py') or
115
 
                t.endswith("urltest.py") or
116
 
                t.endswith("clitest.py")):
 
114
            if (t.endswith("__init__.py") or
 
115
                t.endswith("urltest.py")):
117
116
                continue
118
117
 
119
118
            base = os.path.basename(t)
121
120
                check = os.path.basename(self.testfile)
122
121
                if base != check and base != (check + ".py"):
123
122
                    continue
 
123
            if self.skipcli and base.count("clitest"):
 
124
                continue
124
125
 
125
126
            testfiles.append('.'.join(['tests', os.path.splitext(base)[0]]))
126
127
 
130
131
        self._testfiles = testfiles
131
132
        TestBaseCommand.run(self)
132
133
 
133
 
class TestCLI(TestBaseCommand):
134
 
 
135
 
    description = "Test various CLI invocations"
136
 
 
137
 
    user_options = (TestBaseCommand.user_options +
138
 
                    [("app=", None, "Only run tests for requested app"),
139
 
                    ("category=", None, "Only run tests for the requested "
140
 
                                       "category (install, storage, etc.)")])
141
 
 
142
 
    def initialize_options(self):
143
 
        TestBaseCommand.initialize_options(self)
144
 
        self.app = None
145
 
        self.category = None
146
 
 
147
 
    def run(self):
148
 
        cmd = "python tests/clitest.py"
149
 
        if self.debug:
150
 
            cmd += " debug"
151
 
        if self.app:
152
 
            cmd += " --app %s" % self.app
153
 
        if self.category:
154
 
            cmd += " --category %s" % self.category
155
 
        os.system(cmd)
156
 
 
157
134
class TestURLFetch(TestBaseCommand):
158
135
 
159
136
    description = "Test fetching kernels and isos from various distro trees"
291
268
        inp = infd.read()
292
269
        infd.close()
293
270
 
294
 
 
295
271
        outp = inp.replace("::VARIANT VALUES::", output)
296
272
        if outp != origout or not(os.path.exists(outfile)):
297
273
            outfd = open(outfile, "w")
302
278
        if os.system("make -C man/en"):
303
279
            raise RuntimeError("Couldn't generate man pages.")
304
280
 
 
281
        if os.system("grep -IRq 'Hey!' man/en") == 0:
 
282
            raise RuntimeError("man pages have errors in them! "
 
283
                               "(grep for 'Hey!')")
 
284
 
 
285
 
305
286
class mybuild(build):
306
287
    """ custom build command to compile i18n files"""
307
288
 
371
352
    cmdclass={
372
353
        'test': TestCommand,
373
354
        'test_urls' : TestURLFetch,
374
 
        'test_cli' : TestCLI,
375
355
        'pylint': CheckPylint,
376
356
 
377
357
        'rpm' : myrpm,