catch exception occurring during travis testing

pull/94/head
eric 2020-02-18 10:17:27 -05:00
parent e3f5459f68
commit 8ef04a28e1
1 changed files with 10 additions and 5 deletions

View File

@ -10,6 +10,7 @@ from django.core.exceptions import ValidationError
from django.core import validators from django.core import validators
from django.db import models from django.db import models
from django.db.models.signals import post_save from django.db.models.signals import post_save
fron django.db.utils import OperationalError
from django.forms import GenericIPAddressField as BaseIPAddressField from django.forms import GenericIPAddressField as BaseIPAddressField
from django.urls import reverse from django.urls import reverse
from django.utils import timezone from django.utils import timezone
@ -307,9 +308,13 @@ class BadUsernamePattern(models.Model):
return False return False
def get_special(): def get_special():
specials = Library.objects.filter(user__username='special') try:
for special in specials: specials = Library.objects.filter(user__username='special')
logger.info('special library found') for special in specials:
return special logger.info('special library found')
return None return special
return None
catch OperationalError:
# database not loaded yet, for example during testing
return None