flake8 cleanup

Signed-off-by: Martin Curlej <mcurlej@redhat.com>

removed some noqa tags
This commit is contained in:
Martin Curlej
2017-10-24 15:48:29 +02:00
parent eedf0a1684
commit 60b3d97c97
40 changed files with 297 additions and 221 deletions

View File

@@ -13,7 +13,7 @@ pdc = pdc_client.PDCClient(servername, token=token)
print("Querying for %r to see if it is inactive" % variant_uid)
obj = pdc['unreleasedvariants'][variant_uid]()
assert obj['active'] == False, obj['active']
assert obj['active'] is False, obj['active']
print("Submitting PATCH to activate.")
pdc['unreleasedvariants'][variant_uid] += {'variant_uid': variant_uid, 'active': True}

View File

@@ -13,7 +13,7 @@ pdc = pdc_client.PDCClient(servername, token=token)
print("Querying for %r to see if it is active" % variant_uid)
obj = pdc['unreleasedvariants'][variant_uid]()
assert obj['active'] == True, obj['active']
assert obj['active'], obj['active']
print("Submitting PATCH to deactivate.")
pdc['unreleasedvariants'][variant_uid] += {'variant_uid': variant_uid, 'active': False}

View File

@@ -1,9 +1,12 @@
import requests
import yaml
response = requests.get('https://pdc.fedoraproject.org/rest_api/v1/unreleasedvariants/?variant_version=master&page_size=-1&variant_id=bootstrap')
response = requests.get(
('https://pdc.fedoraproject.org/rest_api/v1/unreleasedvariants/?variant_version=master'
'&page_size=-1&variant_id=bootstrap')
)
data = response.json()
item = data[0]
item['modulemd'] = yaml.load(item['modulemd'])
print yaml.dump(item)
print(yaml.dump(item))

View File

@@ -80,9 +80,11 @@ class BaseConfiguration(object):
# AMQ prefixed variables are required only while using 'amq' as messaging backend
# Addresses to listen to
AMQ_RECV_ADDRESSES = ['amqps://messaging.mydomain.com/Consumer.m8y.VirtualTopic.eng.koji',
'amqps://messaging.mydomain.com/Consumer.m8y.VirtualTopic.eng.module_build_service']
('amqps://messaging.mydomain.com/Consumer.m8y.VirtualTopic.eng.'
'module_build_service')]
# Address for sending messages
AMQ_DEST_ADDRESS = 'amqps://messaging.mydomain.com/Consumer.m8y.VirtualTopic.eng.module_build_service'
AMQ_DEST_ADDRESS = ('amqps://messaging.mydomain.com/Consumer.m8y.'
'VirtualTopic.eng.module_build_service')
AMQ_CERT_FILE = '/etc/module_build_service/msg-m8y-client.crt'
AMQ_PRIVATE_KEY_FILE = '/etc/module_build_service/msg-m8y-client.key'
AMQ_TRUSTED_CERT_FILE = '/etc/module_build_service/Root-CA.crt'
@@ -121,7 +123,10 @@ class DevConfiguration(BaseConfiguration):
else:
# This requires that your principal be listed server side in
# ProxyPrincipals, and that is only true for our modularity system
# user. See: https://infrastructure.fedoraproject.org/cgit/ansible.git/commit/?id=a28a93dad75248c30c1792ec35f588c8e317c067
# user.
# See:
# https://infrastructure.fedoraproject.org/cgit/ansible.git/commit/?id=a28a93dad75248c30c1792ec35f588c8e317c067
# noqa
KOJI_PROXYUSER = False
KOJI_CONFIG = path.join(confdir, 'koji.conf')

View File

@@ -125,6 +125,7 @@ def notfound_error(e):
"""Flask error handler for Conflict exceptions"""
return json_error(404, 'Not Found', e.args[0])
init_logging(conf)
log = getLogger(__name__)
build_logs = ModuleBuildLogs(conf.build_logs_dir)
@@ -146,4 +147,5 @@ def get_url_for(*args, **kwargs):
"multiple session being used in the same time.")
return url_for(*args, **kwargs)
load_views()

View File

@@ -24,7 +24,6 @@
import logging
import os
import re
import koji
import tempfile
import threading
@@ -95,7 +94,8 @@ class CoprModuleBuilder(GenericBuilder):
def _get_copr_safe(self):
kwargs = {
"ownername": self.module.copr_owner or self.owner,
"projectname": self.module.copr_project or CoprModuleBuilder._tag_to_copr_name(self.tag_name)
"projectname": self.module.copr_project or
CoprModuleBuilder._tag_to_copr_name(self.tag_name)
}
try:
@@ -117,7 +117,8 @@ class CoprModuleBuilder(GenericBuilder):
detail = copr.get_project_details().data["detail"]
current_chroots = detail["yum_repos"].keys()
if chroot not in current_chroots:
self.client.modify_project(copr.projectname, copr.username, chroots=current_chroots + [chroot])
self.client.modify_project(copr.projectname, copr.username,
chroots=current_chroots + [chroot])
def _create_module_safe(self):
from copr.exceptions import CoprRequestException
@@ -127,7 +128,8 @@ class CoprModuleBuilder(GenericBuilder):
kwargs = {
"username": self.module.copr_owner or self.owner,
"projectname": self.module.copr_project or CoprModuleBuilder._tag_to_copr_name(self.tag_name),
"projectname": self.module.copr_project or
CoprModuleBuilder._tag_to_copr_name(self.tag_name),
"modulemd": modulemd,
"create": True,
"build": False,
@@ -263,7 +265,8 @@ class CoprModuleBuilder(GenericBuilder):
def build_srpm(self, artifact_name, source, build_id=None):
# Build package from `source`
return self.client.create_new_build(self.copr.projectname, [source], username=self.copr.username,
return self.client.create_new_build(self.copr.projectname, [source],
username=self.copr.username,
chroots=[self.chroot])
def build_scm(self, source):
@@ -275,14 +278,16 @@ class CoprModuleBuilder(GenericBuilder):
branch = git_branch_contains(cod, commit)
rmdir(cod)
return self.client.create_new_build_distgit(self.copr.projectname, url, branch=branch,
username=self.copr.username, chroots=[self.chroot])
username=self.copr.username,
chroots=[self.chroot])
def finalize(self):
modulemd = tempfile.mktemp()
self.module.mmd().dump(modulemd)
# Create a module from previous project
result = self.client.make_module(username=self.copr.username, projectname=self.copr.projectname,
result = self.client.make_module(username=self.copr.username,
projectname=self.copr.projectname,
modulemd=modulemd, create=False, build=True)
os.remove(modulemd)
if result.output != "ok":

View File

@@ -36,7 +36,6 @@ import time
import koji
import module_build_service
from module_build_service import log, build_logs
from module_build_service.builder.KojiModuleBuilder import KojiModuleBuilder
@@ -64,14 +63,15 @@ class KojiContentGenerator(object):
@staticmethod
def parse_rpm_output(output, tags, separator=';'):
"""
Copied from https://github.com/projectatomic/atomic-reactor/blob/master/atomic_reactor/plugins/exit_koji_promote.py
Copied from:
https://github.com/projectatomic/atomic-reactor/blob/master/atomic_reactor/plugins/exit_koji_promote.py
License: BSD 3-clause
Parse output of the rpm query.
:param output: list, decoded output (str) from the rpm subprocess
:param tags: list, str fields used for query output
:return: list, dicts describing each rpm package
"""
""" # noqa
def field(tag):
"""
@@ -129,7 +129,7 @@ class KojiContentGenerator(object):
Build a list of installed RPMs in the format required for the
metadata.
"""
""" # noqa
tags = [
'NAME',
@@ -394,7 +394,6 @@ class KojiContentGenerator(object):
"Koji", nvr, tag)
session.tagBuild(tag_info["id"], nvr)
def koji_import(self):
"""This method imports given module into the configured koji instance as
a content generator based build

View File

@@ -301,9 +301,9 @@ chmod 644 %buildroot/%_sysconfdir/rpm/macros.zz-modules
log.info("%r connecting buildroot." % self)
# Create or update individual tags
# the main tag needs arches so pungi can dump it
self.module_tag = self._koji_create_tag(
self.tag_name, self.arches, perm="admin") # the main tag needs arches so pungi can dump it
self.tag_name, self.arches, perm="admin")
self.module_build_tag = self._koji_create_tag(
self.tag_name + "-build", self.arches, perm="admin")
@@ -453,7 +453,8 @@ chmod 644 %buildroot/%_sysconfdir/rpm/macros.zz-modules
def build(self, artifact_name, source):
"""
:param source : scmurl to spec repository
: param artifact_name: name of artifact (which we couldn't get from spec due involved macros)
: param artifact_name: name of artifact (which we couldn't get
from spec due involved macros)
:return 4-tuple of the form (koji build task id, state, reason, nvr)
"""
@@ -474,7 +475,8 @@ chmod 644 %buildroot/%_sysconfdir/rpm/macros.zz-modules
# more digits of precision than str(time.time())
# Unnamed Engineer: Guido v. R., I am disappoint
return '%s/%r.%s' % (prefix, time.time(),
''.join([random.choice(string.ascii_letters) for i in range(8)]))
''.join([random.choice(string.ascii_letters)
for i in range(8)]))
if not self.__prep:
raise RuntimeError("Buildroot is not prep-ed")
@@ -484,7 +486,8 @@ chmod 644 %buildroot/%_sysconfdir/rpm/macros.zz-modules
if task_info:
log.info("skipping build of %s. Build already exists (task_id=%s), via %s" % (
source, task_info['task_id'], self))
return task_info['task_id'], koji.BUILD_STATES['COMPLETE'], 'Build already exists.', task_info['nvr']
return (task_info['task_id'], koji.BUILD_STATES['COMPLETE'],
'Build already exists.', task_info['nvr'])
self._koji_whitelist_packages([artifact_name])
if '://' not in source:
@@ -550,7 +553,8 @@ chmod 644 %buildroot/%_sysconfdir/rpm/macros.zz-modules
def _koji_add_many_tag_inheritance(self, tag_name, parent_tags):
tag = self._get_tag(tag_name)
# highest priority num is at the end
inheritance_data = sorted(self.koji_session.getInheritanceData(tag['name']) or [], key=lambda k: k['priority'])
inheritance_data = sorted(self.koji_session.getInheritanceData(tag['name']) or
[], key=lambda k: k['priority'])
# Set initial priority to last record in inheritance data or 0
priority = 0
if inheritance_data:
@@ -599,7 +603,8 @@ chmod 644 %buildroot/%_sysconfdir/rpm/macros.zz-modules
for group, packages in groups.items():
group_id = existing_groups.get(group, None)
if group_id is not None:
log.debug("Group %s already exists for tag %s. Skipping creation." % (group, dest_tag))
log.debug("Group %s already exists for tag %s. Skipping creation."
% (group, dest_tag))
continue
self.koji_session.groupListAdd(dest_tag, group)
@@ -640,7 +645,8 @@ chmod 644 %buildroot/%_sysconfdir/rpm/macros.zz-modules
if perm:
if taginfo['locked']:
raise SystemError("Tag %s: master lock already set. Can't edit tag" % taginfo['name'])
raise SystemError("Tag %s: master lock already set. Can't edit tag"
% taginfo['name'])
perm_ids = self.getPerms()
@@ -671,7 +677,8 @@ chmod 644 %buildroot/%_sysconfdir/rpm/macros.zz-modules
# This will help with potential resubmiting of failed builds
pkglists = {}
for tag in tags:
pkglists[tag['id']] = dict([(p['package_name'], p['package_id']) for p in self.koji_session.listPackages(tagID=tag['id'])])
pkglists[tag['id']] = dict([(p['package_name'], p['package_id'])
for p in self.koji_session.listPackages(tagID=tag['id'])])
self.koji_session.multicall = True
for tag in tags:
@@ -691,9 +698,9 @@ chmod 644 %buildroot/%_sysconfdir/rpm/macros.zz-modules
:param build-tag: build_tag name
:param dest_tag: dest tag name
This call is safe to call multiple times. Raises SystemError() if the existing target doesn't match params.
The reason not to touch existing target, is that we don't want to accidentaly alter a target
which was already used to build some artifacts.
This call is safe to call multiple times. Raises SystemError() if the existing target
doesn't match params. The reason not to touch existing target, is that we don't want to
accidentaly alter a target which was already used to build some artifacts.
"""
build_tag = self._get_tag(build_tag)
dest_tag = self._get_tag(dest_tag)
@@ -703,13 +710,18 @@ chmod 644 %buildroot/%_sysconfdir/rpm/macros.zz-modules
assert barches, "Build tag %s has no arches defined." % build_tag['name']
if not target_info:
target_info = self.koji_session.createBuildTarget(name, build_tag['name'], dest_tag['name'])
target_info = self.koji_session.createBuildTarget(name, build_tag['name'],
dest_tag['name'])
else: # verify whether build and destination tag matches
if build_tag['name'] != target_info['build_tag_name']:
raise SystemError("Target references unexpected build_tag_name. Got '%s', expected '%s'. Please contact administrator." % (target_info['build_tag_name'], build_tag['name']))
raise SystemError(("Target references unexpected build_tag_name. "
"Got '%s', expected '%s'. Please contact administrator.")
% (target_info['build_tag_name'], build_tag['name']))
if dest_tag['name'] != target_info['dest_tag_name']:
raise SystemError("Target references unexpected dest_tag_name. Got '%s', expected '%s'. Please contact administrator." % (target_info['dest_tag_name'], dest_tag['name']))
raise SystemError(("Target references unexpected dest_tag_name. "
"Got '%s', expected '%s'. Please contact administrator.")
% (target_info['dest_tag_name'], dest_tag['name']))
return self.koji_session.getBuildTarget(name)

View File

@@ -445,7 +445,8 @@ class MockModuleBuilder(GenericBuilder):
# generate the thread-specific mock config by writing it to fs again.
self._load_mock_config()
self._write_mock_config()
mock_config = os.path.join(self.configdir, "mock-%s.cfg" % str(threading.current_thread().name))
mock_config = os.path.join(self.configdir, "mock-%s.cfg"
% str(threading.current_thread().name))
# Get the build-id in thread-safe manner.
build_id = None
@@ -556,7 +557,7 @@ class SCMBuilder(BaseBuilder):
# If the component has not been built before, then None is returned. Instead,
# let's return 0.0 so the type is consistent
return self.koji_session.getAverageBuildDuration(component.package) or 0.0
except:
except Exception:
log.debug('The Koji call to getAverageBuildDuration failed. Is Koji properly '
'configured?')
return 0.0

View File

@@ -7,7 +7,6 @@ import errno
import logging
import urlgrabber.grabber as grabber
import urlgrabber.progress as progress
import module_build_service
from module_build_service import log

View File

@@ -45,7 +45,7 @@ def init_config(app):
try:
with open(config_file):
config_section = 'ProdConfiguration'
except:
except Exception:
pass
# - Flask app within mod_wsgi presets ProdConfiguration
flask_app_env = hasattr(app, 'request') and hasattr(app.request, 'environ')
@@ -73,7 +73,8 @@ def init_config(app):
if 'MBS_CONFIG_SECTION' in app.request.environ:
config_section = app.request.environ['MBS_CONFIG_SECTION']
# TestConfiguration shall only be used for running tests, otherwise...
if any(['nosetests' in arg or 'noserunner.py' in arg or 'py.test' in arg or 'pytest' in arg for arg in sys.argv]):
if any(['nosetests' in arg or 'noserunner.py' in arg or 'py.test' in arg or 'pytest' in arg
for arg in sys.argv]):
config_section = 'TestConfiguration'
from conf import config
config_module = config
@@ -100,7 +101,7 @@ def init_config(app):
try:
config_module = imp.load_source('mbs_runtime_config',
config_file)
except:
except Exception:
raise SystemError("Configuration file {} was not found."
.format(config_file))
@@ -452,11 +453,12 @@ class Config(object):
# Do no try to convert None...
if value is not None:
value = convert(value)
except:
except Exception:
raise TypeError("Configuration value conversion failed for name: %s" % key)
# unknown type/unsupported conversion, or conversion not needed
elif convert is not None and convert not in [Path]:
raise TypeError("Unsupported type %s for configuration item name: %s" % (convert, key))
raise TypeError("Unsupported type %s for configuration item name: %s"
% (convert, key))
# Set the attribute to the correct value
setattr(self, key, value)
@@ -541,7 +543,7 @@ class Config(object):
raise ValueError('Unsupported authentication method')
if s.lower() == 'kerberos':
try:
import ldap3
import ldap3 # noqa
except ImportError:
raise ValueError("ldap3 is required for kerberos authz")
self._auth_method = s.lower()

View File

@@ -169,7 +169,7 @@ def init_logging(conf):
logging.basicConfig(level=conf.log_level, format=log_format)
try:
from systemd import journal
except:
except Exception:
raise ValueError("systemd.journal module is not installed")
log = logging.getLogger()

View File

@@ -21,7 +21,6 @@
#
# Written by Matt Prahl <mprahl@redhat.com> except for the test functions
import random
from flask_script import Manager
from functools import wraps
import flask_migrate
@@ -147,5 +146,6 @@ def run(host=None, port=None, debug=None):
def manager_wrapper():
manager.run()
if __name__ == "__main__":
manager_wrapper()

View File

@@ -240,7 +240,8 @@ class CoprBuildEnd(KojiBuildChange):
object for a build info from Copr
@TODO There should be a base class for CoprBuildEnd and KojiBuildChange
and conditions in the code should check for it's descendants instead of KojiBuildChange directly.
and conditions in the code should check for it's descendants instead of KojiBuildChange
directly.
In such case this class would not have to inherit from koji class
:param msg_id: the id of the msg (e.g. 2016-SomeGUID)

View File

@@ -125,7 +125,7 @@ def make_session(conf):
try:
yield session
session.commit()
except:
except Exception:
# This is a no-op if no transaction is in progress.
session.rollback()
raise
@@ -149,7 +149,7 @@ class ModuleBuild(MBSBase):
modulemd = db.Column(db.String, nullable=False)
koji_tag = db.Column(db.String) # This gets set after 'wait'
# Koji tag to which tag the Content Generator Koji build.
cg_build_koji_tag = db.Column(db.String) # This gets set after wait
cg_build_koji_tag = db.Column(db.String) # This gets set after wait
copr_owner = db.Column(db.String)
copr_project = db.Column(db.String)
scmurl = db.Column(db.String)
@@ -205,7 +205,7 @@ class ModuleBuild(MBSBase):
mmd = _modulemd.ModuleMetadata()
try:
mmd.loads(self.modulemd)
except:
except Exception:
raise ValueError("Invalid modulemd")
return mmd
@@ -410,9 +410,10 @@ class ModuleBuild(MBSBase):
module_id=module_id).order_by(ModuleBuildTrace.state_time).all()
def __repr__(self):
return "<ModuleBuild %s, id=%d, stream=%s, version=%s, state %r, batch %r, state_reason %r>" % (
self.name, self.id, self.stream, self.version,
INVERSE_BUILD_STATES[self.state], self.batch, self.state_reason)
return (("<ModuleBuild %s, id=%d, stream=%s, version=%s, state %r,"
" batch %r, state_reason %r>")
% (self.name, self.id, self.stream, self.version, INVERSE_BUILD_STATES[self.state],
self.batch, self.state_reason))
class ModuleBuildTrace(MBSBase):
@@ -437,8 +438,8 @@ class ModuleBuildTrace(MBSBase):
return retval
def __repr__(self):
return "<ModuleBuildTrace %s, module_id: %s, state_time: %r, state: %s, state_reason: %s>" % (
self.id, self.module_id, self.state_time, self.state, self.state_reason)
return ("<ModuleBuildTrace %s, module_id: %s, state_time: %r, state: %s, state_reason: %s>"
% (self.id, self.module_id, self.state_time, self.state, self.state_reason))
class ComponentBuild(MBSBase):
@@ -546,7 +547,8 @@ class ComponentBuildTrace(MBSBase):
state_reason = db.Column(db.String, nullable=True)
task_id = db.Column(db.Integer, nullable=True)
component_build = db.relationship('ComponentBuild', backref='component_builds_trace', lazy=False)
component_build = db.relationship('ComponentBuild', backref='component_builds_trace',
lazy=False)
def json(self):
retval = {
@@ -561,8 +563,9 @@ class ComponentBuildTrace(MBSBase):
return retval
def __repr__(self):
return "<ComponentBuildTrace %s, component_id: %s, state_time: %r, state: %s, state_reason: %s, task_id: %s>" % (
self.id, self.component_id, self.state_time, self.state, self.state_reason, self.task_id)
return ("<ComponentBuildTrace %s, component_id: %s, state_time: %r, state: %s,"
" state_reason: %s, task_id: %s>") % (self.id, self.component_id, self.state_time,
self.state, self.state_reason, self.task_id)
def session_before_commit_handlers(session):

View File

@@ -142,7 +142,12 @@ def variant_dict_from_str(module_str):
:param module_str: a string to match in PDC
:return module_info dict
Example minimal module_info {'variant_id': module_name, 'variant_version': module_version, 'variant_type': 'module'}
Example minimal module_info:
{
'variant_id': module_name,
'variant_version': module_version,
'variant_type': 'module'
}
"""
log.debug("variant_dict_from_str(%r)" % module_str)
# best match due several filters not being provided such as variant type ...
@@ -184,11 +189,10 @@ def get_module(session, module_info, strict=False):
# TODO: So far sorting on Fedora prod PDC instance is broken and it sorts
# only by variant_uid by default. Once the sorting is fixed, we can start
# using '-variant_release' ordering and just get the first variant from
# there. But in the meantime, we have to get the first variant with
# there. But in the meantime, we have to get the first variant with
# page_size set to 1 to find out how many variants (pages) are there in
# results set and jump to last one in another query. The last one is always
# the latest one (the one with the highest version).
#query['ordering'] = '-variant_release'
try:
retval = session['unreleasedvariants/'](page_size=1, **query)
except Exception as ex:
@@ -306,7 +310,6 @@ def _get_recursively_required_modules(session, info, modules=None,
modules.append(module_info)
# We want to use the same stream as the one used in the time this
# module was built. But we still should fallback to plain mmd.requires
# in case this module depends on some older module for which we did
@@ -355,7 +358,7 @@ def resolve_profiles(session, mmd, keys):
if local_modules:
local_module = local_modules[0]
log.info("Using local module %r to resolve profiles.",
local_module)
local_module)
dep_mmd = local_module.mmd()
for key in keys:
if key in dep_mmd.profiles:
@@ -430,7 +433,6 @@ def get_module_build_dependencies(session, module_info, strict=False):
}
modules = _get_recursively_required_modules(
session, modified_dep, strict=strict)
tags = [m["koji_tag"] for m in modules]
for m in modules:
if m["koji_tag"] in module_tags:
continue

View File

@@ -63,7 +63,7 @@ class MBSConsumer(fedmsg.consumers.FedmsgConsumer):
# Topic setting needs to be done *before* the call to `super`.
backends = module_build_service.messaging._messaging_backends
prefixes = conf.messaging_topic_prefix # This is a list.
prefixes = conf.messaging_topic_prefix # This is a list.
services = backends[conf.messaging]['services']
suffix = backends[conf.messaging]['topic_suffix']
self.topic = [
@@ -167,8 +167,7 @@ class MBSConsumer(fedmsg.consumers.FedmsgConsumer):
self.shutdown()
def get_abstracted_msg(self, message):
parser = module_build_service.messaging.\
_messaging_backends[conf.messaging].get('parser')
parser = module_build_service.messaging._messaging_backends[conf.messaging].get('parser')
if parser:
try:
return parser.parse(message)

View File

@@ -224,7 +224,7 @@ def wait(config, session, msg):
# Find out the name of Koji tag to which the module's Content
# Generator build should be tagged once the build finishes.
module_names_streams = {mmd.name:mmd.stream
module_names_streams = {mmd.name: mmd.stream
for mmd in deps_dict.values()}
for base_module_name in conf.base_module_names:
if base_module_name in module_names_streams:

View File

@@ -196,7 +196,8 @@ class MBSProducer(PollingProducer):
# Check to see if module builds that are in build state but don't have
# any component builds being built can be worked on
for module_build in session.query(models.ModuleBuild).filter_by(state=models.BUILD_STATES['build']).all():
for module_build in session.query(models.ModuleBuild) \
.filter_by(state=models.BUILD_STATES['build']).all():
# If there are no components in the build state on the module build,
# then no possible event will start off new component builds.
# But do not try to start new builds when we are waiting for the
@@ -230,7 +231,8 @@ class MBSProducer(PollingProducer):
koji_session = module_build_service.builder.KojiModuleBuilder\
.get_session(config, None)
for module_build in session.query(models.ModuleBuild).filter_by(state=models.BUILD_STATES['build']).all():
for module_build in session.query(models.ModuleBuild) \
.filter_by(state=models.BUILD_STATES['build']).all():
if not module_build.new_repo_task_id:
continue

View File

@@ -280,7 +280,7 @@ class SCM(object):
td = tempfile.mkdtemp()
self.checkout(td)
return True
except:
except Exception:
if strict:
raise
return False

View File

@@ -184,7 +184,8 @@ def continue_batch_build(config, module, session, builder, components=None):
if config.num_concurrent_builds > 0:
max_workers = config.num_concurrent_builds
with concurrent.futures.ThreadPoolExecutor(max_workers=max_workers) as executor:
futures = {executor.submit(start_build_component, builder, c): c for c in components_to_build}
futures = {executor.submit(start_build_component, builder, c):
c for c in components_to_build}
concurrent.futures.wait(futures)
# In case there has been an excepion generated directly in the
# start_build_component, the future.result() will re-raise it in the
@@ -276,8 +277,11 @@ def start_next_batch_build(config, module, session, builder, components=None):
active_tasks = builder.list_tasks_for_components(module.component_builds,
state='active')
if isinstance(active_tasks, list) and active_tasks:
state_reason = "Cannot start a batch, because some components are already in 'building' state."
state_reason += " See tasks (ID): {}".format(', '.join([str(t['id']) for t in active_tasks]))
state_reason = ("Cannot start a batch, because some components are already"
" in 'building' state.")
state_reason += " See tasks (ID): {}".format(
', '.join([str(t['id']) for t in active_tasks])
)
module.transition(config, state=models.BUILD_STATES['failed'],
state_reason=state_reason)
session.commit()
@@ -475,8 +479,9 @@ def filter_module_builds(flask_request):
query = query.filter_by(**search_query)
# This is used when filtering the date request parameters, but it is here to avoid recompiling
utc_iso_datetime_regex = re.compile(r'^(?P<datetime>\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})(?:\.\d+)?'
r'(?:Z|[-+]00(?::00)?)?$')
utc_iso_datetime_regex = re.compile(
r'^(?P<datetime>\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})(?:\.\d+)?'
r'(?:Z|[-+]00(?::00)?)?$')
# Filter the query based on date request parameters
for item in ('submitted', 'modified', 'completed'):
@@ -488,10 +493,12 @@ def filter_module_builds(flask_request):
iso_datetime_matches = re.match(utc_iso_datetime_regex, iso_datetime_arg)
if not iso_datetime_matches or not iso_datetime_matches.group('datetime'):
raise ValidationError('An invalid Zulu ISO 8601 timestamp was provided for the "%s" parameter'
raise ValidationError(('An invalid Zulu ISO 8601 timestamp was provided'
' for the "%s" parameter')
% request_arg)
# Converts the ISO 8601 string to a datetime object for SQLAlchemy to use to filter
item_datetime = datetime.strptime(iso_datetime_matches.group('datetime'), '%Y-%m-%dT%H:%M:%S')
item_datetime = datetime.strptime(iso_datetime_matches.group('datetime'),
'%Y-%m-%dT%H:%M:%S')
# Get the database column to filter against
column = getattr(models.ModuleBuild, 'time_' + item)
@@ -690,11 +697,11 @@ def load_local_builds(local_build_nsvs, session=None):
module.koji_tag = path
session.commit()
if (found_build[0] != module.name
or found_build[1] != module.stream
or str(found_build[2]) != module.version):
if (found_build[0] != module.name or found_build[1] != module.stream or
str(found_build[2]) != module.version):
raise RuntimeError(
'Parsed metadata results for "{0}" don\'t match the directory name'.format(found_build[3]))
'Parsed metadata results for "{0}" don\'t match the directory name'
.format(found_build[3]))
log.info("Loaded local module build %r", module)

View File

@@ -80,10 +80,10 @@ api_v1 = {
}
}
class AbstractQueryableBuildAPI(MethodView):
""" An abstract class, housing some common functionality. """
def get(self, id):
verbose_flag = request.args.get('verbose', 'false').lower()
@@ -148,13 +148,14 @@ class ModuleBuildAPI(AbstractQueryableBuildAPI):
try:
r = json.loads(request.get_data().decode("utf-8"))
except:
except Exception:
log.error('Invalid JSON submitted')
raise ValidationError('Invalid JSON submitted')
if "owner" in r:
if conf.no_auth is not True:
raise ValidationError("The request contains 'owner' parameter, however NO_AUTH is not allowed")
raise ValidationError(("The request contains 'owner' parameter,"
" however NO_AUTH is not allowed"))
elif username == "anonymous":
username = r["owner"]
@@ -212,18 +213,22 @@ class BaseHandler(object):
return {k: v for k, v in self.data.items() if k not in ["owner", "scmurl", "branch"]}
def validate_optional_params(self):
forbidden_params = [k for k in self.data if k not in models.ModuleBuild.__table__.columns and
forbidden_params = [k for k in self.data
if k not in models.ModuleBuild.__table__.columns and
k not in ["branch"]]
if forbidden_params:
raise ValidationError('The request contains unspecified parameters: {}'.format(", ".join(forbidden_params)))
raise ValidationError('The request contains unspecified parameters: {}'
.format(", ".join(forbidden_params)))
forbidden_params = [k for k in self.data if k.startswith("copr_")]
if conf.system != "copr" and forbidden_params:
raise ValidationError('The request contains parameters specific to Copr builder: {} even though {} is used'
raise ValidationError(('The request contains parameters specific to Copr builder:'
' {} even though {} is used')
.format(", ".join(forbidden_params), conf.system))
if not conf.no_auth and "owner" in self.data:
raise ValidationError("The request contains 'owner' parameter, however NO_AUTH is not allowed")
raise ValidationError(("The request contains 'owner' parameter,"
" however NO_AUTH is not allowed"))
class SCMHandler(BaseHandler):
@@ -231,7 +236,7 @@ class SCMHandler(BaseHandler):
super(SCMHandler, self).__init__(request)
try:
self.data = json.loads(request.get_data().decode("utf-8"))
except:
except Exception:
log.error('Invalid JSON submitted')
raise ValidationError('Invalid JSON submitted')
@@ -265,7 +270,8 @@ class SCMHandler(BaseHandler):
branch = branch.encode('utf-8')
return submit_module_build_from_scm(self.username, url, branch,
allow_local_url=False, optional_params=self.optional_params)
allow_local_url=False,
optional_params=self.optional_params)
class YAMLFileHandler(BaseHandler):
@@ -283,7 +289,8 @@ class YAMLFileHandler(BaseHandler):
def post(self):
handle = request.files["yaml"]
return submit_module_build_from_yaml(self.username, handle, optional_params=self.optional_params)
return submit_module_build_from_yaml(self.username, handle,
optional_params=self.optional_params)
def register_api_v1():

View File

@@ -32,8 +32,8 @@ setup(name='module-build-service',
'mbs.messaging_backends': [
'fedmsg = module_build_service.messaging:_fedmsg_backend',
'in_memory = module_build_service.messaging:_in_memory_backend',
#'custom = your_organization:_custom_backend',
]
# 'custom = your_organization:_custom_backend',
]
},
scripts=["contrib/mbs-build"],
data_files=[('/etc/module-build-service/', ['conf/cacert.pem',

View File

@@ -43,8 +43,10 @@ def uncompress_vcrpy_cassette():
with tarfile.open(archive, mode='r:gz') as t:
t.extractall(base_dir)
uncompress_vcrpy_cassette()
def init_data():
db.session.remove()
db.drop_all()

View File

@@ -28,7 +28,6 @@ import mock
from mock import patch, PropertyMock, Mock
import kerberos
import ldap3
from flask import Response
from werkzeug.exceptions import Unauthorized as FlaskUnauthorized
import module_build_service.auth
@@ -61,7 +60,8 @@ class TestAuthModule(unittest.TestCase):
# https://www.youtube.com/watch?v=G-LtddOgUCE
name = "Joey Jo Jo Junior Shabadoo"
mocked_get_token_info = {"active": False, "username": name,
"scope": "openid https://id.fedoraproject.org/scope/groups mbs-scope"}
"scope": ("openid https://id.fedoraproject.org/scope/groups"
" mbs-scope")}
get_token_info.return_value = mocked_get_token_info
get_user_info.return_value = {"groups": ["group"]}
@@ -89,7 +89,8 @@ class TestAuthModule(unittest.TestCase):
# https://www.youtube.com/watch?v=G-LtddOgUCE
name = "Joey Jo Jo Junior Shabadoo"
mocked_get_token_info = {"active": True, "username": name,
"scope": "openid https://id.fedoraproject.org/scope/groups mbs-scope"}
"scope": ("openid https://id.fedoraproject.org/scope/groups"
" mbs-scope")}
get_token_info.return_value = mocked_get_token_info
get_user_info.return_value = {"groups": ["group"]}

View File

@@ -253,12 +253,12 @@ class TestBuild(unittest.TestCase):
del sys.modules['twisted.internet.reactor']
del sys.modules['moksha.hub.reactor']
del sys.modules['moksha.hub']
import moksha.hub.reactor
import moksha.hub.reactor # noqa
self.vcr.__exit__()
for i in range(20):
try:
os.remove(build_logs.path(i))
except:
except Exception:
pass
@timed(30)
@@ -270,7 +270,7 @@ class TestBuild(unittest.TestCase):
succeeds everytime.
"""
FakeSCM(mocked_scm, 'testmodule', 'testmodule.yaml',
'620ec77321b2ea7b0d67d82992dda3e1d67055b4')
'620ec77321b2ea7b0d67d82992dda3e1d67055b4')
rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps(
{'branch': 'master', 'scmurl': 'git://pkgs.stg.fedoraproject.org/modules/'
@@ -309,7 +309,8 @@ class TestBuild(unittest.TestCase):
# or "ready" state.
for build in models.ComponentBuild.query.filter_by(module_id=module_build_id).all():
self.assertEqual(build.state, koji.BUILD_STATES['COMPLETE'])
self.assertTrue(build.module_build.state in [models.BUILD_STATES["done"], models.BUILD_STATES["ready"]])
self.assertTrue(build.module_build.state in [models.BUILD_STATES["done"],
models.BUILD_STATES["ready"]])
# All components has to be tagged, so tag_groups and buildroot_groups are empty...
self.assertEqual(tag_groups, [])
@@ -383,7 +384,7 @@ class TestBuild(unittest.TestCase):
Submit all builds for a module and cancel the module build later.
"""
FakeSCM(mocked_scm, 'testmodule', 'testmodule.yaml',
'620ec77321b2ea7b0d67d82992dda3e1d67055b4')
'620ec77321b2ea7b0d67d82992dda3e1d67055b4')
rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps(
{'branch': 'master', 'scmurl': 'git://pkgs.stg.fedoraproject.org/modules/'
@@ -436,7 +437,7 @@ class TestBuild(unittest.TestCase):
succeeds everytime.
"""
FakeSCM(mocked_scm, 'testmodule', 'testmodule.yaml',
'620ec77321b2ea7b0d67d82992dda3e1d67055b4')
'620ec77321b2ea7b0d67d82992dda3e1d67055b4')
rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps(
{'branch': 'master', 'scmurl': 'git://pkgs.stg.fedoraproject.org/modules/'
@@ -456,7 +457,8 @@ class TestBuild(unittest.TestCase):
# or "ready" state.
for build in models.ComponentBuild.query.filter_by(module_id=module_build_id).all():
self.assertEqual(build.state, koji.BUILD_STATES['COMPLETE'])
self.assertTrue(build.module_build.state in [models.BUILD_STATES["done"], models.BUILD_STATES["ready"]])
self.assertTrue(build.module_build.state in [models.BUILD_STATES["done"],
models.BUILD_STATES["ready"]])
@timed(30)
@patch('module_build_service.auth.get_user', return_value=user)
@@ -471,7 +473,7 @@ class TestBuild(unittest.TestCase):
num_concurrent_builds set to 1.
"""
FakeSCM(mocked_scm, 'testmodule', 'testmodule.yaml',
'620ec77321b2ea7b0d67d82992dda3e1d67055b4')
'620ec77321b2ea7b0d67d82992dda3e1d67055b4')
rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps(
{'branch': 'master', 'scmurl': 'git://pkgs.stg.fedoraproject.org/modules/'
@@ -500,7 +502,8 @@ class TestBuild(unittest.TestCase):
self.assertEqual(build.state, koji.BUILD_STATES['COMPLETE'])
# When this fails, it can mean that num_concurrent_builds
# threshold has been met.
self.assertTrue(build.module_build.state in [models.BUILD_STATES["done"], models.BUILD_STATES["ready"]])
self.assertTrue(build.module_build.state in [models.BUILD_STATES["done"],
models.BUILD_STATES["ready"]])
@timed(30)
@patch('module_build_service.auth.get_user', return_value=user)
@@ -516,15 +519,12 @@ class TestBuild(unittest.TestCase):
the num_concurrent_builds to finish.
"""
FakeSCM(mocked_scm, 'testmodule-more-components', 'testmodule-more-components.yaml',
'620ec77321b2ea7b0d67d82992dda3e1d67055b4')
'620ec77321b2ea7b0d67d82992dda3e1d67055b4')
rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps(
self.client.post('/module-build-service/1/module-builds/', data=json.dumps(
{'branch': 'master', 'scmurl': 'git://pkgs.stg.fedoraproject.org/modules/'
'testmodule.git?#68932c90de214d9d13feefbd35246a81b6cb8d49'}))
data = json.loads(rv.data)
module_build_id = data['id']
# Holds the number of concurrent component builds during
# the module build.
TestBuild._global_var = []
@@ -569,7 +569,7 @@ class TestBuild(unittest.TestCase):
are still build, but next batch is not started.
"""
FakeSCM(mocked_scm, 'testmodule', 'testmodule.yaml',
'620ec77321b2ea7b0d67d82992dda3e1d67055b4')
'620ec77321b2ea7b0d67d82992dda3e1d67055b4')
rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps(
{'branch': 'master', 'scmurl': 'git://pkgs.stg.fedoraproject.org/modules/'
@@ -629,7 +629,7 @@ class TestBuild(unittest.TestCase):
are still build, but next batch is not started.
"""
FakeSCM(mocked_scm, 'testmodule', 'testmodule.yaml',
'620ec77321b2ea7b0d67d82992dda3e1d67055b4')
'620ec77321b2ea7b0d67d82992dda3e1d67055b4')
rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps(
{'branch': 'master', 'scmurl': 'git://pkgs.stg.fedoraproject.org/modules/'
@@ -712,7 +712,8 @@ class TestBuild(unittest.TestCase):
# or "ready" state.
for build in models.ComponentBuild.query.filter_by(module_id=2).all():
self.assertEqual(build.state, koji.BUILD_STATES['COMPLETE'])
self.assertTrue(build.module_build.state in [models.BUILD_STATES["done"], models.BUILD_STATES["ready"]])
self.assertTrue(build.module_build.state in [models.BUILD_STATES["done"],
models.BUILD_STATES["ready"]])
self.assertEqual(build.reused_component_id,
reused_component_ids[build.package])
@@ -767,7 +768,8 @@ class TestBuild(unittest.TestCase):
# or "ready" state.
for build in models.ComponentBuild.query.filter_by(module_id=2).all():
self.assertEqual(build.state, koji.BUILD_STATES['COMPLETE'])
self.assertTrue(build.module_build.state in [models.BUILD_STATES["done"], models.BUILD_STATES["ready"]])
self.assertTrue(build.module_build.state in [models.BUILD_STATES["done"],
models.BUILD_STATES["ready"]])
self.assertNotEqual(build.package, "module-build-macros")
@timed(60)
@@ -779,7 +781,7 @@ class TestBuild(unittest.TestCase):
are already built.
"""
FakeSCM(mocked_scm, 'testmodule', 'testmodule.yaml',
'620ec77321b2ea7b0d67d82992dda3e1d67055b4')
'620ec77321b2ea7b0d67d82992dda3e1d67055b4')
rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps(
{'branch': 'master', 'scmurl': 'git://pkgs.stg.fedoraproject.org/modules/'
@@ -808,7 +810,9 @@ class TestBuild(unittest.TestCase):
# or "ready" state.
for build in models.ComponentBuild.query.filter_by(module_id=module_build_id).all():
self.assertEqual(build.state, koji.BUILD_STATES['COMPLETE'])
self.assertTrue(build.module_build.state in [models.BUILD_STATES["done"], models.BUILD_STATES["ready"]])
self.assertTrue(build.module_build.state in [models.BUILD_STATES["done"],
models.BUILD_STATES["ready"]])
@patch("module_build_service.config.Config.system",
new_callable=PropertyMock, return_value="test")
@@ -834,21 +838,20 @@ class TestLocalBuild(unittest.TestCase):
del sys.modules['twisted.internet.reactor']
del sys.modules['moksha.hub.reactor']
del sys.modules['moksha.hub']
import moksha.hub.reactor
import moksha.hub.reactor # noqa
self.vcr.__exit__()
for i in range(20):
try:
os.remove(build_logs.path(i))
except:
except Exception:
pass
@timed(30)
@patch('module_build_service.auth.get_user', return_value=user)
@patch('module_build_service.scm.SCM')
@patch("module_build_service.config.Config.mock_resultsdir",
new_callable=PropertyMock,
return_value=path.join(
base_dir, 'staged_data', "local_builds"))
new_callable=PropertyMock,
return_value=path.join(base_dir, 'staged_data', "local_builds"))
def test_submit_build_local_dependency(
self, resultsdir, mocked_scm, mocked_get_user, conf_system):
"""
@@ -863,7 +866,7 @@ class TestLocalBuild(unittest.TestCase):
'/module-build-service/1/module-builds/', data=json.dumps(
{'branch': 'master',
'scmurl': 'git://pkgs.stg.fedoraproject.org/modules/'
'testmodule.git?#68932c90de214d9d13feefbd35246a81b6cb8d49'}))
'testmodule.git?#68932c90de214d9d13feefbd35246a81b6cb8d49'}))
data = json.loads(rv.data)
module_build_id = data['id']

View File

@@ -42,7 +42,8 @@ class TestCoprBuilder(unittest.TestCase):
@mock.patch("copr.CoprClient.get_module_repo")
def test_tag_to_repo(self, get_module_repo):
# Mock the CoprClient.get_module_repo to return something, without requesting a Copr instance
# Mock the CoprClient.get_module_repo to return something, without requesting a Copr
# instance
def get_module_repo_mock(owner, nvr):
return ResponseMock({
"output": "ok",
@@ -52,7 +53,8 @@ class TestCoprBuilder(unittest.TestCase):
repo = module_build_service.builder.GenericBuilder.tag_to_repo(
"copr", self.config, "foo-module-name-0.25-9", None)
self.assertEquals(repo, "http://copr-be-instance/results/@copr/foo-module-name-0.25-9/modules")
self.assertEquals(repo,
"http://copr-be-instance/results/@copr/foo-module-name-0.25-9/modules")
@mock.patch("copr.CoprClient.get_module_repo")
def test_non_existing_tag_to_repo(self, get_module_repo):
@@ -104,7 +106,6 @@ class TestCoprModuleBuilder(unittest.TestCase):
self.config.koji_repository_url = conf.koji_repository_url
self.module = module_build_service.models.ModuleBuild.query.filter_by(id=1).one()
@mock.patch("copr.client.CoprClient.create_from_file_config")
def create_builder(self, create_from_file_config):
builder = CoprModuleBuilder(owner=self.module.owner,
@@ -112,16 +113,17 @@ class TestCoprModuleBuilder(unittest.TestCase):
config=conf,
tag_name='module-nginx-1.2',
components=[])
builder.client = CoprClient(username="myself", login="", token="", copr_url="http://example.com/")
builder.client = CoprClient(username="myself", login="", token="",
copr_url="http://example.com/")
builder.copr = Munch(projectname="someproject", username="myself")
return builder
####################################################################################################################
# #
# ModuleBuilder common operations #
# e.g. finalizing the module build process #
# #
####################################################################################################################
###############################################################################################
# #
# ModuleBuilder common operations #
# e.g. finalizing the module build process #
# #
###############################################################################################
@mock.patch("copr.client.CoprClient.make_module")
def test_finalize(self, make_module):
@@ -133,12 +135,12 @@ class TestCoprModuleBuilder(unittest.TestCase):
self.assertIsInstance(kwargs["modulemd"], str)
self.assertTrue(os.path.isabs(kwargs["modulemd"]))
####################################################################################################################
# #
# ModuleBuilder operations for connecting to the buildroot #
# e.g. creating copr projects and modules in it #
# #
####################################################################################################################
###############################################################################################
# #
# ModuleBuilder operations for connecting to the buildroot #
# e.g. creating copr projects and modules in it #
# #
###############################################################################################
@mock.patch(COPR_MODULE_BUILDER + "._update_chroot")
@mock.patch(COPR_MODULE_BUILDER + "._get_copr_safe")
@@ -154,7 +156,8 @@ class TestCoprModuleBuilder(unittest.TestCase):
@mock.patch(COPR_MODULE_BUILDER + "._get_copr")
@mock.patch(COPR_MODULE_BUILDER + "._create_copr")
@mock.patch(COPR_MODULE_BUILDER + "._create_chroot_safe")
@mock.patch("copr.client.CoprClient.create_project") # So that python-copr-1.79-1 is not required
# So that python-copr-1.79-1 is not required
@mock.patch("copr.client.CoprClient.create_project")
def test_get_copr_safe(self, create_project, create_chroot_safe, create_copr, get_copr):
builder = self.create_builder()
@@ -176,7 +179,7 @@ class TestCoprModuleBuilder(unittest.TestCase):
builder = self.create_builder()
copr = builder._get_copr("myself", "someproject")
self.assertEqual(copr.username, "myself")
self.assertEqual(copr.projectname , "someproject")
self.assertEqual(copr.projectname, "someproject")
@mock.patch("copr.client.CoprClient.create_project")
def test_create_copr(self, create_project):
@@ -198,12 +201,12 @@ class TestCoprModuleBuilder(unittest.TestCase):
builder = self.create_builder()
self.assertTrue(builder.buildroot_ready(artifacts=["a1", "a2", "a3"]))
####################################################################################################################
# #
# ModuleBuilder operations with buildroot #
# e.g. adding repositories and packages into the buildroot #
# #
####################################################################################################################
##############################################################################################
# #
# ModuleBuilder operations with buildroot #
# e.g. adding repositories and packages into the buildroot #
# #
##############################################################################################
@mock.patch("copr.client.CoprClient.get_chroot", return_value=FakeCoprAPI.get_chroot())
@mock.patch("copr.client.CoprClient.edit_chroot")
@@ -225,7 +228,8 @@ class TestCoprModuleBuilder(unittest.TestCase):
repos=mock.ANY, packages=mock.ANY)
args, kwargs = edit_chroot.call_args
self.assertEqual(set(kwargs["packages"].split()), {"pkg1", "pkg2", "pkg3"})
self.assertEqual(set(kwargs["repos"].split()), {"http://repo1.ex/", "http://repo2.ex/", "http://repo3.ex/"})
self.assertEqual(set(kwargs["repos"].split()), {"http://repo1.ex/", "http://repo2.ex/",
"http://repo3.ex/"})
# Update multiple buildroot options at the same time
builder._update_chroot(packages=["pkg4", "pkg5"], repos=["http://repo3.ex/"])
@@ -233,7 +237,8 @@ class TestCoprModuleBuilder(unittest.TestCase):
repos=mock.ANY, packages=mock.ANY)
args, kwargs = edit_chroot.call_args
self.assertEqual(set(kwargs["packages"].split()), {"pkg1", "pkg2", "pkg3", "pkg4", "pkg5"})
self.assertEqual(set(kwargs["repos"].split()), {"http://repo1.ex/", "http://repo2.ex/", "http://repo3.ex/"})
self.assertEqual(set(kwargs["repos"].split()), {"http://repo1.ex/", "http://repo2.ex/",
"http://repo3.ex/"})
def test_buildroot_add_artifacts(self):
pass
@@ -249,15 +254,16 @@ class TestCoprModuleBuilder(unittest.TestCase):
conf.koji_repository_url + "/baz/latest/x86_64",
# We always add this repo as a workaround, see the code for details
"https://kojipkgs.fedoraproject.org/compose/latest-Fedora-Modular-26/compose/Server/x86_64/os/",
("https://kojipkgs.fedoraproject.org/compose"
"/latest-Fedora-Modular-26/compose/Server/x86_64/os/"),
})
####################################################################################################################
# #
# ModuleBuilder package build operations #
# e.g. building a package from SCM or SRPM #
# #
####################################################################################################################
##############################################################################################
# #
# ModuleBuilder package build operations #
# e.g. building a package from SCM or SRPM #
# #
##############################################################################################
@mock.patch(COPR_MODULE_BUILDER + ".build_srpm")
@mock.patch(COPR_MODULE_BUILDER + ".build_scm")

View File

@@ -29,7 +29,7 @@ from os import path
from os.path import dirname
import module_build_service.messaging
import module_build_service.scheduler.handlers.repos
import module_build_service.scheduler.handlers.repos # noqa
from module_build_service import models, conf, build_logs
from mock import patch, Mock, MagicMock, call
@@ -72,7 +72,7 @@ class TestBuild(unittest.TestCase):
del sys.modules['twisted.internet.reactor']
del sys.modules['moksha.hub.reactor']
del sys.modules['moksha.hub']
import moksha.hub.reactor
import moksha.hub.reactor # noqa
self.vcr.__exit__()
try:
path = build_logs.path(self.cg.module.id)
@@ -84,7 +84,8 @@ class TestBuild(unittest.TestCase):
@patch("pkg_resources.get_distribution")
@patch("platform.linux_distribution")
@patch("platform.machine")
@patch("module_build_service.builder.KojiContentGenerator.KojiContentGenerator._koji_rpms_in_tag")
@patch(("module_build_service.builder.KojiContentGenerator.KojiContentGenerator."
"_koji_rpms_in_tag"))
def test_get_generator_json(self, rpms_in_tag, machine, distro, pkg_res, popen):
""" Test generation of content generator json """
distro.return_value = ("Fedora", "25", "Twenty Five")
@@ -124,7 +125,8 @@ class TestBuild(unittest.TestCase):
@patch("pkg_resources.get_distribution")
@patch("platform.linux_distribution")
@patch("platform.machine")
@patch("module_build_service.builder.KojiContentGenerator.KojiContentGenerator._koji_rpms_in_tag")
@patch(("module_build_service.builder.KojiContentGenerator.KojiContentGenerator."
"_koji_rpms_in_tag"))
def test_get_generator_json_no_log(self, rpms_in_tag, machine, distro, pkg_res, popen):
""" Test generation of content generator json """
distro.return_value = ("Fedora", "25", "Twenty Five")

View File

@@ -23,9 +23,10 @@
import unittest
from module_build_service import messaging
from module_build_service.messaging import KojiRepoChange
from module_build_service.messaging import KojiRepoChange # noqa
from mock import patch, PropertyMock
class TestFedmsgMessaging(unittest.TestCase):
def test_buildsys_state_change(self):
@@ -68,7 +69,8 @@ class TestFedmsgMessaging(unittest.TestCase):
'status': 1,
'user': 'fatka',
'version': '1.5.23.1-1.20150203.git.c8504a8a.fc21',
'what': 'build end: user:fatka copr:mutt-kz build:100 ip:172.16.3.3 pid:12010 status:1',
'what': ('build end: user:fatka copr:mutt-kz build:100 ip:172.16.3.3 '
'pid:12010 status:1'),
'who': 'worker-2'
},
'msg_id': '2013-b05a323d-37ee-4396-9635-7b5dfaf5441b',
@@ -87,7 +89,8 @@ class TestFedmsgMessaging(unittest.TestCase):
self.assertEqual(msg.build_version, '1.5.23.1')
self.assertEqual(msg.build_release, '1.20150203.git.c8504a8a.fc21')
self.assertEqual(msg.state_reason,
'build end: user:fatka copr:mutt-kz build:100 ip:172.16.3.3 pid:12010 status:1')
('build end: user:fatka copr:mutt-kz build:100 ip:172.16.3.3 '
'pid:12010 status:1'))
def test_buildsys_tag(self):
# https://fedora-fedmsg.readthedocs.io/en/latest/topics.html#id134

View File

@@ -41,7 +41,8 @@ class TestModels(unittest.TestCase):
component_build.format = 'rpms'
component_build.task_id = 999999999
component_build.state = 1
component_build.nvr = 'before_models_committed-0.0.0-0.module_before_models_committed_0_0'
component_build.nvr = ('before_models_committed-0.0.0-0'
'.module_before_models_committed_0_0')
component_build.batch = 1
component_build.module_id = 1

View File

@@ -110,11 +110,10 @@ class TestPDCModule(unittest.TestCase):
self.assertEqual(set(result), set(expected))
@patch("module_build_service.config.Config.system",
new_callable=PropertyMock, return_value="test")
new_callable=PropertyMock, return_value="test")
@patch("module_build_service.config.Config.mock_resultsdir",
new_callable=PropertyMock,
return_value=os.path.join(
base_dir, 'staged_data', "local_builds"))
new_callable=PropertyMock,
return_value=os.path.join(base_dir, 'staged_data', "local_builds"))
def test_get_module_build_dependencies_recursive_requires(
self, resultdir, conf_system):
"""
@@ -124,7 +123,7 @@ class TestPDCModule(unittest.TestCase):
with app.app_context():
module_build_service.utils.load_local_builds(
["base-runtime", "parent", "child", "testmodule"])
build = module_build_service.models.ModuleBuild.local_modules(
db.session, "child", "master")
result = mbs_pdc.get_module_build_dependencies(self.pdc, build[0].mmd()).keys()
@@ -164,11 +163,10 @@ class TestPDCModule(unittest.TestCase):
self.assertEqual(result, expected)
@patch("module_build_service.config.Config.system",
new_callable=PropertyMock, return_value="test")
new_callable=PropertyMock, return_value="test")
@patch("module_build_service.config.Config.mock_resultsdir",
new_callable=PropertyMock,
return_value=os.path.join(
base_dir, 'staged_data', "local_builds"))
new_callable=PropertyMock,
return_value=os.path.join(base_dir, 'staged_data', "local_builds"))
def test_resolve_profiles_local_module(self, local_builds, conf_system):
with app.app_context():
module_build_service.utils.load_local_builds(["base-runtime"])
@@ -178,8 +176,7 @@ class TestPDCModule(unittest.TestCase):
current_dir, 'staged_data', 'formatted_testmodule.yaml')
mmd = modulemd.ModuleMetadata()
mmd.load(yaml_path)
result = mbs_pdc.resolve_profiles(self.pdc, mmd,
('buildroot', 'srpm-buildroot'))
result = mbs_pdc.resolve_profiles(self.pdc, mmd, ('buildroot', 'srpm-buildroot'))
expected = {
'buildroot':
set(['foo']),

View File

@@ -23,6 +23,7 @@ from mock import patch, MagicMock
from module_build_service.scheduler.consumer import MBSConsumer
from module_build_service.messaging import KojiTagChange, KojiRepoChange
class TestConsumer(unittest.TestCase):
@patch('module_build_service.messaging.conf.messaging', new='fedmsg')

View File

@@ -63,13 +63,13 @@ class TestModuleInit(unittest.TestCase):
try:
path = build_logs.path(1)
os.remove(path)
except:
except Exception:
pass
@patch('module_build_service.scm.SCM')
def test_init_basic(self, mocked_scm):
FakeSCM(mocked_scm, 'testmodule', 'testmodule.yaml',
'620ec77321b2ea7b0d67d82992dda3e1d67055b4')
'620ec77321b2ea7b0d67d82992dda3e1d67055b4')
msg = module_build_service.messaging.MBSModule(
msg_id=None, module_build_id=1, module_build_state='init')
with make_session(conf) as session:
@@ -86,7 +86,7 @@ class TestModuleInit(unittest.TestCase):
raise RuntimeError("Failed in mocked_scm_get_latest")
FakeSCM(mocked_scm, 'testmodule', 'testmodule.yaml',
'620ec77321b2ea7b0d67d82992dda3e1d67055b4')
'620ec77321b2ea7b0d67d82992dda3e1d67055b4')
mocked_scm.return_value.get_latest = mocked_scm_get_latest
msg = module_build_service.messaging.MBSModule(
msg_id=None, module_build_id=1, module_build_state='init')
@@ -138,8 +138,8 @@ class TestModuleInit(unittest.TestCase):
@patch('module_build_service.scm.SCM')
def test_init_when_get_latest_raises(self, mocked_scm, mocked_from_module_event):
FakeSCM(mocked_scm, 'testmodule', 'testmodule.yaml',
'7035bd33614972ac66559ac1fdd019ff6027ad22',
get_latest_raise=True)
'7035bd33614972ac66559ac1fdd019ff6027ad22',
get_latest_raise=True)
msg = module_build_service.messaging.MBSModule(
msg_id=None, module_build_id=1, module_build_state='init')
with make_session(conf) as session:

View File

@@ -53,7 +53,7 @@ class TestModuleWait(unittest.TestCase):
try:
path = build_logs.path(1)
os.remove(path)
except:
except Exception:
pass
@mock.patch('module_build_service.builder.GenericBuilder.create_from_module')
@@ -110,7 +110,8 @@ class TestModuleWait(unittest.TestCase):
builder.koji_session = koji_session
builder.module_build_tag = {"name": "module-123-build"}
builder.get_disttag_srpm.return_value = 'some srpm disttag'
builder.build.return_value = 1234, koji.BUILD_STATES['COMPLETE'], "", "module-build-macros-1-1"
builder.build.return_value = (1234, koji.BUILD_STATES['COMPLETE'], "",
"module-build-macros-1-1")
create_builder.return_value = builder
msg = module_build_service.messaging.MBSModule(msg_id=None, module_build_id=1,
@@ -146,7 +147,8 @@ class TestModuleWait(unittest.TestCase):
builder.koji_session = koji_session
builder.module_build_tag = {"name": "module-123-build"}
builder.get_disttag_srpm.return_value = 'some srpm disttag'
builder.build.return_value = 1234, koji.BUILD_STATES['BUILDING'], "", "module-build-macros-1-1"
builder.build.return_value = (1234, koji.BUILD_STATES['BUILDING'], "",
"module-build-macros-1-1")
create_builder.return_value = builder
msg = module_build_service.messaging.MBSModule(msg_id=None, module_build_id=1,
@@ -182,7 +184,8 @@ class TestModuleWait(unittest.TestCase):
builder.koji_session = koji_session
builder.module_build_tag = {"name": "module-123-build"}
builder.get_disttag_srpm.return_value = 'some srpm disttag'
builder.build.return_value = 1234, koji.BUILD_STATES['BUILDING'], "", "module-build-macros-1-1"
builder.build.return_value = (1234, koji.BUILD_STATES['BUILDING'], "",
"module-build-macros-1-1")
create_builder.return_value = builder
msg = module_build_service.messaging.MBSModule(msg_id=None, module_build_id=1,
@@ -192,7 +195,6 @@ class TestModuleWait(unittest.TestCase):
module_build = ModuleBuild.query.filter_by(id=1).one()
self.assertEqual(module_build.cg_build_koji_tag, "modular-updates-candidate")
@patch("module_build_service.builder.GenericBuilder.default_buildroot_groups",
return_value={'build': [], 'srpm-build': []})
@patch("module_build_service.builder.KojiModuleBuilder.get_session")
@@ -222,7 +224,8 @@ class TestModuleWait(unittest.TestCase):
builder.koji_session = koji_session
builder.module_build_tag = {"name": "module-123-build"}
builder.get_disttag_srpm.return_value = 'some srpm disttag'
builder.build.return_value = 1234, koji.BUILD_STATES['BUILDING'], "", "module-build-macros-1-1"
builder.build.return_value = (1234, koji.BUILD_STATES['BUILDING'], "",
"module-build-macros-1-1")
create_builder.return_value = builder
msg = module_build_service.messaging.MBSModule(msg_id=None, module_build_id=1,

View File

@@ -258,8 +258,8 @@ class TestPoller(unittest.TestCase):
if state_name in ["done", "ready", "failed"]:
koji_session.deleteBuildTarget.assert_called_once_with(852)
def test_process_waiting_module_build(
self, create_builder, koji_get_session, global_consumer, dbg):
def test_process_waiting_module_build(self, create_builder, koji_get_session,
global_consumer, dbg):
""" Test that processing old waiting module builds works. """
consumer = mock.MagicMock()
@@ -289,9 +289,8 @@ class TestPoller(unittest.TestCase):
# ensure the time_modified was changed.
self.assertGreater(module_build.time_modified, original)
def test_process_waiting_module_build_not_old_enough(
self, create_builder, koji_get_session, global_consumer, dbg):
def test_process_waiting_module_build_not_old_enough(self, create_builder, koji_get_session,
global_consumer, dbg):
""" Test that we do not process young waiting builds. """
consumer = mock.MagicMock()
@@ -319,8 +318,8 @@ class TestPoller(unittest.TestCase):
# Ensure we did *not* process the 9 minute-old build.
self.assertEquals(consumer.incoming.qsize(), 0)
def test_process_waiting_module_build_none_found(
self, create_builder, koji_get_session, global_consumer, dbg):
def test_process_waiting_module_build_none_found(self, create_builder, koji_get_session,
global_consumer, dbg):
""" Test nothing happens when no module builds are waiting. """
consumer = mock.MagicMock()

View File

@@ -60,7 +60,8 @@ class TestRepoDone(unittest.TestCase):
@mock.patch('module_build_service.builder.KojiModuleBuilder.get_average_build_time',
return_value=0.0)
@mock.patch('module_build_service.builder.KojiModuleBuilder.list_tasks_for_components', return_value=[])
@mock.patch('module_build_service.builder.KojiModuleBuilder.list_tasks_for_components',
return_value=[])
@mock.patch('module_build_service.builder.KojiModuleBuilder.buildroot_ready', return_value=True)
@mock.patch('module_build_service.builder.KojiModuleBuilder.get_session')
@mock.patch('module_build_service.builder.KojiModuleBuilder.build')
@@ -77,11 +78,13 @@ class TestRepoDone(unittest.TestCase):
config=conf, session=db.session, msg=msg)
build_fn.assert_called_once_with(
artifact_name='communicator',
source='git://pkgs.domain.local/rpms/communicator?#da95886c8a443b36a9ce31abda1f9bed22f2f9c2')
source=('git://pkgs.domain.local/rpms/communicator'
'?#da95886c8a443b36a9ce31abda1f9bed22f2f9c2'))
@mock.patch('module_build_service.builder.KojiModuleBuilder.get_average_build_time',
return_value=0.0)
@mock.patch('module_build_service.builder.KojiModuleBuilder.list_tasks_for_components', return_value=[])
@mock.patch('module_build_service.builder.KojiModuleBuilder.list_tasks_for_components',
return_value=[])
@mock.patch('module_build_service.builder.KojiModuleBuilder.buildroot_ready', return_value=True)
@mock.patch('module_build_service.builder.KojiModuleBuilder.get_session')
@mock.patch('module_build_service.builder.KojiModuleBuilder.build')
@@ -100,18 +103,21 @@ class TestRepoDone(unittest.TestCase):
config=conf, session=db.session, msg=msg)
build_fn.assert_called_once_with(
artifact_name='communicator',
source='git://pkgs.domain.local/rpms/communicator?#da95886c8a443b36a9ce31abda1f9bed22f2f9c2')
source=('git://pkgs.domain.local/rpms/communicator'
'?#da95886c8a443b36a9ce31abda1f9bed22f2f9c2'))
component_build = module_build_service.models.ComponentBuild.query\
.filter_by(package='communicator').one()
self.assertEquals(component_build.state_reason,
'Failed to submit artifact communicator to Koji')
@mock.patch('module_build_service.builder.KojiModuleBuilder.list_tasks_for_components', return_value=[])
@mock.patch('module_build_service.builder.KojiModuleBuilder.list_tasks_for_components',
return_value=[])
@mock.patch('module_build_service.builder.KojiModuleBuilder.buildroot_ready', return_value=True)
@mock.patch('module_build_service.builder.KojiModuleBuilder.get_session')
@mock.patch('module_build_service.builder.KojiModuleBuilder.build')
@mock.patch('module_build_service.builder.KojiModuleBuilder.buildroot_connect')
@mock.patch("module_build_service.builder.GenericBuilder.default_buildroot_groups", return_value={'build': [], 'srpm-build': []})
@mock.patch("module_build_service.builder.GenericBuilder.default_buildroot_groups",
return_value={'build': [], 'srpm-build': []})
def test_failed_component_build(self, dbg, connect, build_fn, config, ready, list_tasks_fn):
""" Test that when a KojiModuleBuilder.build fails, the build is
marked as failed with proper state_reason.
@@ -128,4 +134,5 @@ class TestRepoDone(unittest.TestCase):
module_build = module_build_service.models.ModuleBuild.query\
.filter_by(name='starcommand').one()
self.assertEquals(module_build.state, module_build_service.models.BUILD_STATES["failed"])
self.assertEquals(module_build.state,
module_build_service.models.BUILD_STATES["failed"])

View File

@@ -322,7 +322,6 @@ class TestTagTagged(unittest.TestCase):
# status later in poller.
self.assertEqual(module_build.new_repo_task_id, 123456)
@patch("module_build_service.builder.GenericBuilder.default_buildroot_groups",
return_value={'build': [], 'srpm-build': []})
@patch("module_build_service.builder.KojiModuleBuilder.get_session")

View File

@@ -579,7 +579,7 @@ class TestUtils(unittest.TestCase):
component states properly.
"""
FakeSCM(mocked_scm, 'testmodule', 'testmodule.yaml',
'620ec77321b2ea7b0d67d82992dda3e1d67055b4')
'620ec77321b2ea7b0d67d82992dda3e1d67055b4')
with app.app_context():
test_reuse_component_init_data()
# Mark the module build as failed, so we can resubmit it.
@@ -716,7 +716,8 @@ class DummyModuleBuilder(GenericBuilder):
pass
@patch("module_build_service.builder.GenericBuilder.default_buildroot_groups", return_value={'build': [], 'srpm-build': []})
@patch("module_build_service.builder.GenericBuilder.default_buildroot_groups",
return_value={'build': [], 'srpm-build': []})
class TestBatches(unittest.TestCase):
def setUp(self):
@@ -927,7 +928,7 @@ class TestLocalBuilds(unittest.TestCase):
with app.app_context():
with self.assertRaises(RuntimeError):
module_build_service.utils.load_local_builds("testmodule:x")
local_modules = models.ModuleBuild.local_modules(db.session)
models.ModuleBuild.local_modules(db.session)
def test_load_local_builds_name_stream_version(
self, conf_system, conf_resultsdir):
@@ -944,7 +945,7 @@ class TestLocalBuilds(unittest.TestCase):
with app.app_context():
with self.assertRaises(RuntimeError):
module_build_service.utils.load_local_builds("testmodule:master:123")
local_modules = models.ModuleBuild.local_modules(db.session)
models.ModuleBuild.local_modules(db.session)
def test_load_local_builds_base_runtime(
self, conf_system, conf_resultsdir):

View File

@@ -22,13 +22,12 @@
import unittest
import json
import time
import vcr
import modulemd as _modulemd
import module_build_service.scm
from mock import patch, PropertyMock, MagicMock
from mock import patch, PropertyMock
from shutil import copyfile
from os import path, mkdir
from os.path import dirname
@@ -36,8 +35,8 @@ import hashlib
from tests import app, init_data
from module_build_service.errors import UnprocessableEntity
from module_build_service.models import ComponentBuild, ModuleBuild
from module_build_service import conf, db, version
from module_build_service.models import ModuleBuild
from module_build_service import db, version
import module_build_service.config as mbs_config
import module_build_service.scheduler.handlers.modules
@@ -93,7 +92,7 @@ class FakeSCM(object):
def checkout(self, temp_dir):
try:
mmd_filename = self.mmd_filenames[self.checkout_id]
except:
except Exception:
mmd_filename = self.mmd_filenames[0]
self.sourcedir = path.join(temp_dir, self.name)
@@ -371,7 +370,9 @@ class TestViews(unittest.TestCase):
self.assertEquals(data['meta']['total'], 0)
def test_query_component_builds_filter_nvr(self):
rv = self.client.get('/module-build-service/1/component-builds/?nvr=nginx-1.10.1-2.module_nginx_1_2')
rv = self.client.get(
'/module-build-service/1/component-builds/?nvr=nginx-1.10.1-2.module_nginx_1_2'
)
data = json.loads(rv.data)
self.assertEquals(data['meta']['total'], 10)
@@ -498,7 +499,7 @@ class TestViews(unittest.TestCase):
@patch('module_build_service.scm.SCM')
def test_submit_build(self, mocked_scm, mocked_get_user):
FakeSCM(mocked_scm, 'testmodule', 'testmodule.yaml',
'620ec77321b2ea7b0d67d82992dda3e1d67055b4')
'620ec77321b2ea7b0d67d82992dda3e1d67055b4')
rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps(
{'branch': 'master', 'scmurl': 'git://pkgs.stg.fedoraproject.org/modules/'
@@ -529,7 +530,7 @@ class TestViews(unittest.TestCase):
@patch('module_build_service.scm.SCM')
def test_submit_componentless_build(self, mocked_scm, mocked_get_user):
FakeSCM(mocked_scm, 'fakemodule', 'fakemodule.yaml',
'3da541559918a808c2402bba5012f6c60b27661c')
'3da541559918a808c2402bba5012f6c60b27661c')
rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps(
{'branch': 'master', 'scmurl': 'git://pkgs.stg.fedoraproject.org/modules/'
@@ -605,7 +606,7 @@ class TestViews(unittest.TestCase):
def test_submit_build_includedmodule_custom_repo_not_allowed(self,
mocked_scm, mocked_get_user):
FakeSCM(mocked_scm, "includedmodules", ["includedmodules.yaml",
"testmodule.yaml"])
"testmodule.yaml"])
rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps(
{'branch': 'master', 'scmurl': 'git://pkgs.stg.fedoraproject.org/modules/'
'testmodule.git?#68931c90de214d9d13feefbd35246a81b6cb8d49'}))
@@ -707,7 +708,7 @@ class TestViews(unittest.TestCase):
@patch('module_build_service.scm.SCM')
def test_submit_build_version_set_error(self, mocked_scm, mocked_get_user):
FakeSCM(mocked_scm, 'testmodule', 'testmodule-version-set.yaml',
'620ec77321b2ea7b0d67d82992dda3e1d67055b4')
'620ec77321b2ea7b0d67d82992dda3e1d67055b4')
rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps(
{'branch': 'master', 'scmurl': 'git://pkgs.stg.fedoraproject.org/modules/'
@@ -725,7 +726,7 @@ class TestViews(unittest.TestCase):
@patch('module_build_service.scm.SCM')
def test_submit_build_wrong_stream(self, mocked_scm, mocked_get_user):
FakeSCM(mocked_scm, 'testmodule', 'testmodule-wrong-stream.yaml',
'620ec77321b2ea7b0d67d82992dda3e1d67055b4')
'620ec77321b2ea7b0d67d82992dda3e1d67055b4')
rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps(
{'branch': 'master', 'scmurl': 'git://pkgs.stg.fedoraproject.org/modules/'
@@ -753,10 +754,11 @@ class TestViews(unittest.TestCase):
@patch('module_build_service.auth.get_user', return_value=anonymous_user)
@patch('module_build_service.scm.SCM')
@patch("module_build_service.config.Config.no_auth", new_callable=PropertyMock, return_value=True)
@patch("module_build_service.config.Config.no_auth", new_callable=PropertyMock,
return_value=True)
def test_submit_build_no_auth_set_owner(self, mocked_conf, mocked_scm, mocked_get_user):
FakeSCM(mocked_scm, 'testmodule', 'testmodule.yaml',
'620ec77321b2ea7b0d67d82992dda3e1d67055b4')
'620ec77321b2ea7b0d67d82992dda3e1d67055b4')
data = {
'branch': 'master',
@@ -775,7 +777,7 @@ class TestViews(unittest.TestCase):
@patch("module_build_service.config.Config.no_auth", new_callable=PropertyMock)
def test_patch_set_different_owner(self, mocked_no_auth, mocked_scm, mocked_get_user):
FakeSCM(mocked_scm, 'testmodule', 'testmodule.yaml',
'620ec77321b2ea7b0d67d82992dda3e1d67055b4')
'620ec77321b2ea7b0d67d82992dda3e1d67055b4')
mocked_no_auth.return_value = True
data = {
@@ -803,7 +805,7 @@ class TestViews(unittest.TestCase):
@patch('module_build_service.scm.SCM')
def test_submit_build_commit_hash_not_found(self, mocked_scm, mocked_get_user):
FakeSCM(mocked_scm, 'testmodule', 'testmodule.yaml',
'7035bd33614972ac66559ac1fdd019ff6027ad22', checkout_raise=True)
'7035bd33614972ac66559ac1fdd019ff6027ad22', checkout_raise=True)
rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps(
{'branch': 'master', 'scmurl': 'git://pkgs.stg.fedoraproject.org/modules/'
@@ -821,7 +823,7 @@ class TestViews(unittest.TestCase):
@patch("module_build_service.config.Config.allow_custom_scmurls", new_callable=PropertyMock)
def test_submit_custom_scmurl(self, allow_custom_scmurls, mocked_scm, mocked_get_user):
FakeSCM(mocked_scm, 'testmodule', 'testmodule.yaml',
'620ec77321b2ea7b0d67d82992dda3e1d67055b4')
'620ec77321b2ea7b0d67d82992dda3e1d67055b4')
def submit(scmurl):
return self.client.post('/module-build-service/1/module-builds/', data=json.dumps(

View File

@@ -35,7 +35,7 @@ commands =
basepython = python2
skip_install = true
deps = flake8
commands = flake8 --ignore E501,E731
commands = flake8 --ignore E731 --exclude .tox,.git,module_build_service/migrations
ignore_outcome = True
[testenv:bandit]