]> code.ossystems Code Review - openembedded-core.git/commitdiff
scripts/oe-selftest: avoid the creation of coverage file when coverage not installed
authorHumberto Ibarra <humberto.ibarra.lopez@intel.com>
Wed, 6 Apr 2016 03:15:54 +0000 (22:15 -0500)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 5 Apr 2016 22:12:41 +0000 (23:12 +0100)
Coverage subprocessing file is being created even when coverage
is not installed, which causes errors of "module not found" to
be send to the oe-selftest output.

This patch adds indent to the block of code creating this coverage
file, so it can only be executed when coverage is actually
installed.

[Yocto #9334]

Signed-off-by: Humberto Ibarra <humberto.ibarra.lopez@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/oe-selftest

index 375ba5c4155a436a3cfc92d37e453056ca0f465b..3d2dffb5c2a02a16a096ca6da7b26a8b720772ce 100755 (executable)
@@ -584,20 +584,20 @@ def buildResultClass(args):
                 if self.coverage_installed:
                     log.info("Coverage is enabled")
 
-                # In case the user has not set the variable COVERAGE_PROCESS_START,
-                # create a default one and export it. The COVERAGE_PROCESS_START
-                # value indicates where the coverage configuration file resides
-                # More info on https://pypi.python.org/pypi/coverage
-                if not os.environ.get('COVERAGE_PROCESS_START'):
-                    os.environ['COVERAGE_PROCESS_START'] = coverage_setup(args.coverage_source, args.coverage_include, args.coverage_omit)
-
-                # Use default site.USER_SITE and write corresponding config file
-                site.ENABLE_USER_SITE = True
-                if not os.path.exists(site.USER_SITE):
-                    os.makedirs(site.USER_SITE)
-                self.coveragepth = os.path.join(site.USER_SITE, "coverage.pth")
-                with open(self.coveragepth, 'w') as cps:
-                    cps.write('import sys,site; sys.path.extend(site.getsitepackages()); import coverage; coverage.process_startup();')
+                    # In case the user has not set the variable COVERAGE_PROCESS_START,
+                    # create a default one and export it. The COVERAGE_PROCESS_START
+                    # value indicates where the coverage configuration file resides
+                    # More info on https://pypi.python.org/pypi/coverage
+                    if not os.environ.get('COVERAGE_PROCESS_START'):
+                        os.environ['COVERAGE_PROCESS_START'] = coverage_setup(args.coverage_source, args.coverage_include, args.coverage_omit)
+
+                    # Use default site.USER_SITE and write corresponding config file
+                    site.ENABLE_USER_SITE = True
+                    if not os.path.exists(site.USER_SITE):
+                        os.makedirs(site.USER_SITE)
+                    self.coveragepth = os.path.join(site.USER_SITE, "coverage.pth")
+                    with open(self.coveragepth, 'w') as cps:
+                        cps.write('import sys,site; sys.path.extend(site.getsitepackages()); import coverage; coverage.process_startup();')
 
         def stopTestRun(self):
             """ Report coverage data after the testcases are run """