42:06c224e8b052
Anton Shestakov <av6@dwimlabs.net>, Sun, 19 Jun 2016 14:07:11 +0800
incoming: skip checking the whole line when it's linter output When a line starts with a certain pattern, it's recognized as linter output, but determining if it's an error or a warning was done looking at the whole string again multiple times. Let's save on regexes and look only on the important part.

next change 46:0f45e02848a1
previous change 35:d0d03f67dc1f

tests/test_models.py

Permissions: -rw-r--r--

Other formats: Feeds:
from datetime import datetime, timedelta
from candolint.models import Check
def test_duration():
now = datetime.now()
check = Check(started=now)
check.finished = now + timedelta(seconds=10)
assert check.get_duration() == '10 sec'
check.finished = now + timedelta(minutes=5)
assert check.get_duration() == '5 min'
check.finished = now + timedelta(hours=2)
assert check.get_duration() == '120 min'