mirror of
https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
synced 2025-06-07 15:51:29 +00:00
Add some '# pragma: no cover' for error cases, abstract methods, etc.
Signed-off-by: Niels Thykier <niels@thykier.net>
This commit is contained in:
parent
5bcbed499e
commit
b16ae8046a
@ -256,7 +256,7 @@ class Britney(object):
|
|||||||
'DEBUG': 'N',
|
'DEBUG': 'N',
|
||||||
}
|
}
|
||||||
|
|
||||||
def record_factory(*args, **kwargs):
|
def record_factory(*args, **kwargs): # pragma: no cover
|
||||||
record = old_factory(*args, **kwargs)
|
record = old_factory(*args, **kwargs)
|
||||||
try:
|
try:
|
||||||
record.shortlevelname = short_level_mapping[record.levelname]
|
record.shortlevelname = short_level_mapping[record.levelname]
|
||||||
@ -453,7 +453,7 @@ class Britney(object):
|
|||||||
not getattr(self.options, k.lower()):
|
not getattr(self.options, k.lower()):
|
||||||
setattr(self.options, k.lower(), v)
|
setattr(self.options, k.lower(), v)
|
||||||
|
|
||||||
if hasattr(self.options, 'components'):
|
if hasattr(self.options, 'components'): # pragma: no cover
|
||||||
self.logger.error("The COMPONENTS configuration has been removed.")
|
self.logger.error("The COMPONENTS configuration has been removed.")
|
||||||
self.logger.error("Britney will read the value from the Release file automatically")
|
self.logger.error("Britney will read the value from the Release file automatically")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@ -462,7 +462,7 @@ class Britney(object):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
self.suite_info = suite_loader.load_suites()
|
self.suite_info = suite_loader.load_suites()
|
||||||
except MissingRequiredConfigurationError as e:
|
except MissingRequiredConfigurationError as e: # pragma: no cover
|
||||||
self.logger.error("Could not load the suite content due to missing configuration: %s", str(e))
|
self.logger.error("Could not load the suite content due to missing configuration: %s", str(e))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
self.all_binaries = suite_loader.all_binaries()
|
self.all_binaries = suite_loader.all_binaries()
|
||||||
|
@ -64,7 +64,7 @@ class SuiteContentLoader(object):
|
|||||||
return self._all_binaries
|
return self._all_binaries
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def load_suites(self):
|
def load_suites(self): # pragma: no cover
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ class DebMirrorLikeSuiteContentLoader(SuiteContentLoader):
|
|||||||
self.logger.info("Using components listed in Release file: %s", ' '.join(self._components))
|
self.logger.info("Using components listed in Release file: %s", ' '.join(self._components))
|
||||||
|
|
||||||
if self._architectures is None:
|
if self._architectures is None:
|
||||||
if release_file is None:
|
if release_file is None: # pragma: no cover
|
||||||
self.logger.error("No configured architectures and there is no release file in the %s suite.",
|
self.logger.error("No configured architectures and there is no release file in the %s suite.",
|
||||||
target_suite.name)
|
target_suite.name)
|
||||||
self.logger.error("Please check if there is a \"Release\" file in %s",
|
self.logger.error("Please check if there is a \"Release\" file in %s",
|
||||||
|
@ -334,11 +334,11 @@ class AgePolicy(BasePolicy):
|
|||||||
continue
|
continue
|
||||||
# <source> <version> <date>)
|
# <source> <version> <date>)
|
||||||
l = line.split()
|
l = line.split()
|
||||||
if len(l) != 3:
|
if len(l) != 3: # pragma: no cover
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
dates[l[0]] = (l[1], int(l[2]))
|
dates[l[0]] = (l[1], int(l[2]))
|
||||||
except ValueError:
|
except ValueError: # pragma: no cover
|
||||||
pass
|
pass
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
if not using_new_name:
|
if not using_new_name:
|
||||||
@ -549,7 +549,7 @@ class RCBugPolicy(BasePolicy):
|
|||||||
self.logger.info("Loading RC bugs data from %s", filename)
|
self.logger.info("Loading RC bugs data from %s", filename)
|
||||||
for line in open(filename, encoding='ascii'):
|
for line in open(filename, encoding='ascii'):
|
||||||
l = line.split()
|
l = line.split()
|
||||||
if len(l) != 2:
|
if len(l) != 2: # pragma: no cover
|
||||||
self.logger.warning("Malformed line found in line %s", line)
|
self.logger.warning("Malformed line found in line %s", line)
|
||||||
continue
|
continue
|
||||||
pkg = l[0]
|
pkg = l[0]
|
||||||
|
@ -73,7 +73,7 @@ def ifilter_only(container, iterable=None):
|
|||||||
|
|
||||||
|
|
||||||
# iter_except is from the "itertools" recipe
|
# iter_except is from the "itertools" recipe
|
||||||
def iter_except(func, exception, first=None):
|
def iter_except(func, exception, first=None): # pragma: no cover - itertools recipe function
|
||||||
""" Call a function repeatedly until an exception is raised.
|
""" Call a function repeatedly until an exception is raised.
|
||||||
|
|
||||||
Converts a call-until-exception interface to an iterator interface.
|
Converts a call-until-exception interface to an iterator interface.
|
||||||
@ -308,7 +308,7 @@ def write_excuses(excuselist, dest_file, output_format="yaml"):
|
|||||||
for e in excuselist:
|
for e in excuselist:
|
||||||
f.write("<li>%s" % e.html())
|
f.write("<li>%s" % e.html())
|
||||||
f.write("</ul></body></html>\n")
|
f.write("</ul></body></html>\n")
|
||||||
else:
|
else: # pragma: no cover
|
||||||
raise ValueError('Output format must be either "yaml or "legacy-html"')
|
raise ValueError('Output format must be either "yaml or "legacy-html"')
|
||||||
|
|
||||||
|
|
||||||
@ -592,7 +592,7 @@ def possibly_compressed(path, *, permitted_compressions=None):
|
|||||||
cpath = "%s.%s" % (path, ext)
|
cpath = "%s.%s" % (path, ext)
|
||||||
if os.path.exists(cpath):
|
if os.path.exists(cpath):
|
||||||
return cpath
|
return cpath
|
||||||
raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), path)
|
raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), path) # pragma: no cover
|
||||||
|
|
||||||
|
|
||||||
def create_provides_map(packages):
|
def create_provides_map(packages):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user