New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mutation testing improvements #96

Merged
merged 47 commits into from Oct 6, 2016
Commits
Jump to file or symbol
Failed to load files and symbols.
+765 −248
Diff settings

Always

Just for now

View
@@ -293,7 +293,7 @@ def __str__(self):
"""Return a string formatted for output to a kickstart file."""
retval = ""
if self.platform != "":
if self.platform:
retval += "#platform=%s\n" % self.platform
retval += "#version=%s\n" % versionToString(self.version)
@@ -26,7 +26,7 @@ class FC3_Authconfig(KickstartCommand):
removedAttrs = KickstartCommand.removedAttrs
def __init__(self, writePriority=0, *args, **kwargs):
KickstartCommand.__init__(self, *args, **kwargs)
KickstartCommand.__init__(self, writePriority, *args, **kwargs)
self.authconfig = kwargs.get("authconfig", "")
def __str__(self):
@@ -52,7 +52,7 @@ def _getParser(self):
By default, passwords are normally encrypted and
are not shadowed.""", version=FC3)
op.add_argument("options", metavar="[options]", nargs=1, help="""
op.add_argument("options", metavar="[options]", help="""
See ``man authconfig``.""", version=FC3)
return op
@@ -82,8 +82,8 @@ def __str__(self):
if self.encrypted:
retval += " --encrypted"
if self.passphrase != "":
retval += " --passphrase=\"%s\"" % self.passphrase
if self.passphrase:
retval += " --passphrase=\"%s\""% self.passphrase
retval += "\n"
return retval
@@ -123,7 +123,7 @@ def __str__(self):
if not self.autopart:
return retval
if self.encrypted and self.escrowcert != "":
if self.encrypted and self.escrowcert:
retval = retval.strip()
retval += " --escrowcert=\"%s\"" % self.escrowcert
@@ -48,17 +48,17 @@ def __init__(self, writePriority=10, *args, **kwargs):
def _getArgsAsStr(self):
retval = ""
if self.appendLine != "":
if self.appendLine:
retval += " --append=\"%s\"" % self.appendLine
if self.linear:
retval += " --linear"
if self.location:
retval += " --location=%s" % self.location
if hasattr(self, "forceLBA") and self.forceLBA:
retval += " --lba32"
if self.password != "":
if self.password:
retval += " --password=\"%s\"" % self.password
if self.md5pass != "":
if self.md5pass:
retval += " --md5pass=\"%s\"" % self.md5pass
if self.upgrade:
retval += " --upgrade"
@@ -72,7 +72,7 @@ def _getArgsAsStr(self):
def __str__(self):
retval = KickstartCommand.__str__(self)
if self.location != "":
if self.location:
retval += "# System bootloader configuration\nbootloader"
retval += self._getArgsAsStr() + "\n"
@@ -149,15 +149,15 @@ def __init__(self, writePriority=10, *args, **kwargs):
def _getArgsAsStr(self):
retval = ""
if self.appendLine != "":
if self.appendLine:
retval += " --append=\"%s\"" % self.appendLine
if self.location:
retval += " --location=%s" % self.location
if hasattr(self, "forceLBA") and self.forceLBA:
retval += " --lba32"
if self.password != "":
if self.password:
retval += " --password=\"%s\"" % self.password
if self.md5pass != "":
if self.md5pass:
retval += " --md5pass=\"%s\"" % self.md5pass
if self.upgrade:
retval += " --upgrade"
@@ -88,7 +88,7 @@ def __init__(self, *args, **kwargs):
def _getArgsAsStr(self):
retval = F17_BTRFSData._getArgsAsStr(self)
if self.mkfsopts != "":
if self.mkfsopts:
retval += " --mkfsoptions=\"%s\"" % self.mkfsopts
return retval
@@ -211,23 +211,23 @@ def parse(self, args):
elif data.preexist:
data.format = False
if len(extra) == 0:
if not extra:
raise KickstartParseError(formatErrorMsg(self.lineno, msg=_("btrfs must be given a mountpoint")))
elif any(arg for arg in extra if arg.startswith("-")):
mapping = {"command": "btrfs", "options": extra}
raise KickstartParseError(formatErrorMsg(self.lineno, msg=_("Unexpected arguments to %(command)s command: %(options)s") % mapping))
if len(extra) == 1 and not data.subvol:
data.mountpoint = extra[0]
data.devices = extra[1:]
if not any([data.devices, data.subvol]):
raise KickstartParseError(formatErrorMsg(self.lineno, msg=_("btrfs must be given a list of partitions")))
elif len(extra) == 1:
elif not data.devices:
raise KickstartParseError(formatErrorMsg(self.lineno, msg=_("btrfs subvol requires specification of parent volume")))
if data.subvol and not data.name:
raise KickstartParseError(formatErrorMsg(self.lineno, msg=_("btrfs subvolume requires a name")))
data.mountpoint = extra[0]
data.devices = extra[1:]
# Check for duplicates in the data list.
if data in self.dataList():
warnings.warn(_("A btrfs volume with the mountpoint %s has already been defined.") % data.label)
@@ -37,7 +37,7 @@ def __str__(self):
return retval
def parse(self, args):
if len(args) > 0:
if args:
raise KickstartParseError(formatErrorMsg(self.lineno, msg=_("Kickstart command %s does not take any arguments") % self.currentCmd))
return self
@@ -54,7 +54,7 @@ def __str__(self):
else:
initstr = ""
if len(self.drives) > 0:
if self.drives:
drivestr = " --drives=" + ",".join(self.drives)
else:
drivestr = ""
@@ -107,7 +107,7 @@ def __init__(self, *args, **kwargs):
def __str__(self):
s = super(F17_ClearPart, self).__str__()
if s and len(self.devices) > 0:
if s and self.devices:
s = s.rstrip()
s += " --list=" + ",".join(self.devices)
s += "\n"
@@ -46,10 +46,10 @@ def __ne__(self, y):
def __str__(self):
retval = BaseData.__str__(self)
if self.moduleName != "":
if self.moduleName:
retval += "device %s" % self.moduleName
if self.moduleOpts != "":
if self.moduleOpts:
retval += " --opts=\"%s\"" % self.moduleOpts
return retval + "\n"
@@ -78,10 +78,10 @@ def __ne__(self, y):
def __str__(self):
retval = KickstartCommand.__str__(self)
if self.moduleName != "":
if self.moduleName:
retval += "device %s %s" % (self.type, self.moduleName)
if self.moduleOpts != "":
if self.moduleOpts:
retval += " --opts=\"%s\"" % self.moduleOpts
return retval + "\n"
@@ -32,7 +32,7 @@ def __init__(self, writePriority=0, *args, **kwargs):
def __str__(self):
retval = KickstartCommand.__str__(self)
if self.deviceprobe != "":
if self.deviceprobe:
retval += "deviceprobe %s\n" % self.deviceprobe
return retval
@@ -49,7 +49,7 @@ def __str__(self):
return retval
def parse(self, args):
if len(args) > 0:
if args:
raise KickstartParseError(formatErrorMsg(self.lineno, msg=_("Kickstart command %s does not take any arguments") % self.currentCmd))
if self.currentCmd == "cmdline":
@@ -58,6 +58,8 @@ def parse(self, args):
self.displayMode = DISPLAY_MODE_GRAPHICAL
elif self.currentCmd == "text":
self.displayMode = DISPLAY_MODE_TEXT
else:
raise KickstartParseError(formatErrorMsg(self.lineno, msg=_("Unknown command %s") % self.currentCmd))
return self
@@ -28,8 +28,8 @@ class FC3_DriverDiskData(BaseData):
removedKeywords = BaseData.removedKeywords
removedAttrs = BaseData.removedAttrs
def __init__(self, writePriority=0, *args, **kwargs):
BaseData.__init__(self, writePriority, *args, **kwargs)
def __init__(self, *args, **kwargs):
BaseData.__init__(self, *args, **kwargs)
self.partition = kwargs.get("partition", "")
self.source = kwargs.get("source", "")
@@ -56,7 +56,7 @@ class FC4_DriverDiskData(FC3_DriverDiskData):
removedKeywords = FC3_DriverDiskData.removedKeywords
removedAttrs = FC3_DriverDiskData.removedAttrs
def __init__(self, writePriority=0, *args, **kwargs):
def __init__(self, *args, **kwargs):
FC3_DriverDiskData.__init__(self, *args, **kwargs)
self.deleteRemovedAttrs()
@@ -127,7 +127,7 @@ def parse(self, args):
if len(ns.partition) > 1:
raise KickstartParseError(formatErrorMsg(self.lineno, msg=_("Only one partition may be specified for driverdisk command.")))
elif len(extra) > 0:
elif extra:
mapping = {"command": "driverdisk", "options": extra}
raise KickstartParseError(formatErrorMsg(self.lineno, msg=_("Unexpected arguments to %(command)s command: %(options)s") % mapping))
@@ -168,7 +168,7 @@ def parse(self, args):
if len(ns.partition) > 1:
raise KickstartParseError(formatErrorMsg(self.lineno, msg=_("Only one partition may be specified for driverdisk command.")))
elif len(extra) > 0:
elif extra:
mapping = {"command": "driverdisk", "options": extra}
raise KickstartParseError(formatErrorMsg(self.lineno, msg=_("Unexpected arguments to %(command)s command: %(options)s") % mapping))
@@ -27,8 +27,8 @@
class F20_Eula(KickstartCommand):
"""The 'eula' kickstart command"""
def __init__(self, *args, **kwargs):
KickstartCommand.__init__(self, *args, **kwargs)
def __init__(self, writePriority=0, *args, **kwargs):
KickstartCommand.__init__(self, writePriority, *args, **kwargs)
self.op = self._getParser()
self.agreed = kwargs.get("agreed", False)
@@ -61,7 +61,7 @@ def parse(self, args):
self.set_to_self(ns)
if len(extra) != 0:
if extra:
raise KickstartParseError(formatErrorMsg(self.lineno, msg=_("Kickstart command %s does not take any arguments") % "eula"))
if not self.agreed:
@@ -62,15 +62,13 @@ def __str__(self):
# All the port:proto strings go into a comma-separated list.
portstr = ",".join(filteredPorts)
if len(portstr) > 0:
if portstr:
portstr = " --port=" + portstr
else:
portstr = ""
extrastr = "".join(extra)
truststr = ",".join(self.trusts)
if len(truststr) > 0:
if truststr:
truststr = " --trust=" + truststr
# The output port list consists only of port:proto for
@@ -170,10 +168,8 @@ def __str__(self):
retval = retval.strip()
svcstr = ",".join(self.services)
if len(svcstr) > 0:
if svcstr:
svcstr = " --service=" + svcstr
else:
svcstr = ""
return retval + "%s\n" % svcstr
else:
@@ -238,10 +234,8 @@ def __str__(self):
retval = retval.strip()
svcstr = ",".join(self.remove_services)
if len(svcstr) > 0:
if svcstr:
svcstr = " --remove-service=" + svcstr
else:
svcstr = ""
return retval + "%s\n" % svcstr
else:
@@ -36,7 +36,7 @@ def __init__(self, writePriority=0, *args, **kwargs):
def __str__(self):
retval = KickstartCommand.__str__(self)
if len(self.ignoredisk) > 0:
if self.ignoredisk:
retval += "ignoredisk --drives=%s\n" % ",".join(self.ignoredisk)
return retval
@@ -69,9 +69,9 @@ def __init__(self, writePriority=0, *args, **kwargs):
def __str__(self):
retval = KickstartCommand.__str__(self)
if len(self.ignoredisk) > 0:
if self.ignoredisk:
retval += "ignoredisk --drives=%s\n" % ",".join(self.ignoredisk)
elif len(self.onlyuse) > 0:
elif self.onlyuse:
retval += "ignoredisk --only-use=%s\n" % ",".join(self.onlyuse)
return retval
@@ -80,9 +80,15 @@ def parse(self, args):
retval = FC3_IgnoreDisk.parse(self, args)
if not isinstance(self, RHEL6_IgnoreDisk):
if (len(self.ignoredisk) == 0 and len(self.onlyuse) == 0) or (len(self.ignoredisk) > 0 and (len(self.onlyuse) > 0)):
howmany = 0
if self.ignoredisk:
howmany += 1
if self.onlyuse:
howmany += 1
if howmany != 1:
raise KickstartParseError(formatErrorMsg(self.lineno, msg=_("One of --drives or --only-use must be specified for ignoredisk command.")))
return retval
def _getParser(self):
@@ -116,9 +122,9 @@ def parse(self, args):
retval = F8_IgnoreDisk.parse(self, args)
howmany = 0
if len(self.ignoredisk) > 0:
if self.ignoredisk:
howmany += 1
if len(self.onlyuse) > 0:
if self.onlyuse:
howmany += 1
if self.interactive:
howmany += 1
Oops, something went wrong.
ProTip! Use n and p to navigate between commits in a pull request.