From ef4f75b088b09d4ed86ff02bb69cd4046cccb3f6 Mon Sep 17 00:00:00 2001 From: Mitsuhiko Yamazaki Date: Fri, 8 Mar 2013 17:01:09 +0900 Subject: Prevent nova services' coverage data from combining into nova-api's Now if combining a coverage report once, nova services' coverage data are combined into nova-api's. This renames nova-api coverage datafile to .nova-coverage.api and creates a new coverage instance to combine when reporting. Fixes bug: 1152475 Change-Id: I90b6535d490cf0123a127f8752986edd782ef37e --- nova/api/openstack/compute/contrib/coverage_ext.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'nova/api') diff --git a/nova/api/openstack/compute/contrib/coverage_ext.py b/nova/api/openstack/compute/contrib/coverage_ext.py index bafb6711e..ad30987ff 100644 --- a/nova/api/openstack/compute/contrib/coverage_ext.py +++ b/nova/api/openstack/compute/contrib/coverage_ext.py @@ -66,7 +66,7 @@ class CoverageController(object): if not self._cover_inst: try: import coverage - data_out = os.path.join(self.data_path, '.nova-coverage') + data_out = os.path.join(self.data_path, '.nova-coverage.api') self._cover_inst = coverage.coverage(data_file=data_out) except ImportError: pass @@ -224,17 +224,20 @@ class CoverageController(object): html = body['html'] if self.combine: - self.coverInst.combine() + data_out = os.path.join(self.data_path, '.nova-coverage') + import coverage + coverInst = coverage.coverage(data_file=data_out) + coverInst.combine() if xml: - self.coverInst.xml_report(outfile=path) + coverInst.xml_report(outfile=path) elif html: if os.path.isdir(path): msg = _("Directory conflict: %s already exists") raise exc.HTTPBadRequest(explanation=msg) - self.coverInst.html_report(directory=path) + coverInst.html_report(directory=path) else: output = open(path, 'w') - self.coverInst.report(file=output) + coverInst.report(file=output) output.close() for service in self.services: service['telnet'].close() -- cgit