mirror of
https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
synced 2025-04-07 17:21:22 +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',
|
||||
}
|
||||
|
||||
def record_factory(*args, **kwargs):
|
||||
def record_factory(*args, **kwargs): # pragma: no cover
|
||||
record = old_factory(*args, **kwargs)
|
||||
try:
|
||||
record.shortlevelname = short_level_mapping[record.levelname]
|
||||
@ -453,7 +453,7 @@ class Britney(object):
|
||||
not getattr(self.options, k.lower()):
|
||||
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("Britney will read the value from the Release file automatically")
|
||||
sys.exit(1)
|
||||
@ -462,7 +462,7 @@ class Britney(object):
|
||||
|
||||
try:
|
||||
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))
|
||||
sys.exit(1)
|
||||
self.all_binaries = suite_loader.all_binaries()
|
||||
|
@ -64,7 +64,7 @@ class SuiteContentLoader(object):
|
||||
return self._all_binaries
|
||||
|
||||
@abstractmethod
|
||||
def load_suites(self):
|
||||
def load_suites(self): # pragma: no cover
|
||||
pass
|
||||
|
||||
|
||||
@ -146,7 +146,7 @@ class DebMirrorLikeSuiteContentLoader(SuiteContentLoader):
|
||||
self.logger.info("Using components listed in Release file: %s", ' '.join(self._components))
|
||||
|
||||
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.",
|
||||
target_suite.name)
|
||||
self.logger.error("Please check if there is a \"Release\" file in %s",
|
||||
|
@ -334,11 +334,11 @@ class AgePolicy(BasePolicy):
|
||||
continue
|
||||
# <source> <version> <date>)
|
||||
l = line.split()
|
||||
if len(l) != 3:
|
||||
if len(l) != 3: # pragma: no cover
|
||||
continue
|
||||
try:
|
||||
dates[l[0]] = (l[1], int(l[2]))
|
||||
except ValueError:
|
||||
except ValueError: # pragma: no cover
|
||||
pass
|
||||
except FileNotFoundError:
|
||||
if not using_new_name:
|
||||
@ -549,7 +549,7 @@ class RCBugPolicy(BasePolicy):
|
||||
self.logger.info("Loading RC bugs data from %s", filename)
|
||||
for line in open(filename, encoding='ascii'):
|
||||
l = line.split()
|
||||
if len(l) != 2:
|
||||
if len(l) != 2: # pragma: no cover
|
||||
self.logger.warning("Malformed line found in line %s", line)
|
||||
continue
|
||||
pkg = l[0]
|
||||
|
@ -73,7 +73,7 @@ def ifilter_only(container, iterable=None):
|
||||
|
||||
|
||||
# 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.
|
||||
|
||||
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:
|
||||
f.write("<li>%s" % e.html())
|
||||
f.write("</ul></body></html>\n")
|
||||
else:
|
||||
else: # pragma: no cover
|
||||
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)
|
||||
if os.path.exists(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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user