Skip to content
This repository has been archived by the owner on Oct 3, 2018. It is now read-only.

Commit

Permalink
Merge pull request #270 from novafloss/fixes
Browse files Browse the repository at this point in the history
Fixes & updates
  • Loading branch information
bersace committed Feb 21, 2017
2 parents 608a4a8 + a96b11a commit 6d401de
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 1 deletion jenkins_epo/extensions/core.py
Expand Up @@ -509,7 +509,7 @@ def run(self):

logger.info("Unskipping %s.", context)
self.current.last_commit.maybe_update_status(CommitStatus(
status, state='pending', description='Backed!',
status, state='pending', description='Backed',
))


Expand Down
2 changes: 1 addition & 1 deletion jenkins_epo/extensions/jenkins.py
Expand Up @@ -80,7 +80,7 @@ def run(self):
yield from switch_coro()
toqueue_contexts = []
for context in not_built:
logger.debug("Computing next state for %s.", spec)
logger.debug("Computing next state for %s.", context)
new_status = self.current.last_commit.maybe_update_status(
self.status_for_new_context(job, context, queue_empty),
)
Expand Down
2 changes: 1 addition & 1 deletion jenkins_epo/jenkins.py
Expand Up @@ -259,7 +259,7 @@ def __str__(self):

@property
def commit_status(self):
state, description = self._status_map[self.payload['result']]
state, description = self._status_map[self.payload.get('result')]
description = description % dict(
name=self.payload['displayName'],
duration=format_duration(self.payload['duration']),
Expand Down
8 changes: 6 additions & 2 deletions jenkins_epo/procedures.py
Expand Up @@ -18,10 +18,10 @@

from .bot import Bot
from .github import GITHUB, cached_arequest
from .repository import REPOSITORIES, Head, UnauthorizedRepository
from .repository import Repository, REPOSITORIES, Head, UnauthorizedRepository
from .settings import SETTINGS
from .tasks import PrinterTask, ProcessTask, RepositoryPollerTask
from .utils import retry
from .utils import match, retry
from .workers import WORKERS

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -60,6 +60,10 @@ def print_heads():

@asyncio.coroutine
def process_url(url, throttle=True):
if not match(url, Repository.heads_filter):
logger.debug("Skipping %s. Filtered.", url)
return

task = asyncio.Task.current_task()
running_task = _task_map.get(url)
if running_task and not running_task.done():
Expand Down
2 changes: 1 addition & 1 deletion jenkins_epo/workers.py
Expand Up @@ -75,7 +75,7 @@ def worker(self, id_):
except CancelledError:
logger.warn("Cancel of %s", item)
except Exception as e:
if SETTINGS.VERBOSE:
if SETTINGS.VERBOSE or SETTINGS.DEBUG:
logger.exception("Failed to process %s: %s", item, e)
else:
logger.error("Failed to process %s: %s", item, e)
Expand Down
13 changes: 13 additions & 0 deletions tests/test_procedures.py
Expand Up @@ -48,6 +48,19 @@ def test_print(mocker, SETTINGS, WORKERS):
assert WORKERS.queue.join.mock_calls


@pytest.mark.asyncio
@asyncio.coroutine
def test_process_url_skip(mocker, SETTINGS):
heads_filter = mocker.patch(
'jenkins_epo.procedures.Repository.heads_filter', []
)
heads_filter[:] = ['NONE']

from jenkins_epo.procedures import process_url

yield from process_url('url://')


@pytest.mark.asyncio
@asyncio.coroutine
def test_process_url(mocker, SETTINGS):
Expand Down

0 comments on commit 6d401de

Please sign in to comment.